Skip to content
Source
Sign inSign up
TanStack/query

Bug: isPending stuck on true after mutation error #9608

Send to my agent
Closedklawijuice(GitHub profile, opens in a new tab) opened this issue 1 comment

Describe the bug

When using useMutation, if the mutation throws (e.g., Axios returns 500), both onError and onSettled callbacks are called, but isPending never resets to false.

Your minimal, reproducible example

htts://

Steps to reproduce

Actual behavior

onError fires ✅

onSettled fires ✅

isPending remains true ❌

Expected behavior

isPending should reset to false after the mutation settles, even when an error is thrown.

How often does this bug happen?

None

Screenshots or Videos

https://github.com/user-attachments/assets/5ff71d5f-f250-4726-9589-fe8e567b2bc4

Platform

iOS / Android

Tanstack Query adapter

react-query

TanStack Query version

5.85.6

TypeScript version

No response

Additional context

No response

  1. TkDodocommented

    Please show a minimal reproduction with that “bug”. Here is one where everything just works fine:

    https://stackblitz.com/edit/tanstack-query-sgc3tkf9?file=src%2Findex.tsx&preset=node

  2. TkDodo closed this

  3. TkDodo added labelsneeds-info

Sign in to join this conversation.