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
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