TanStackT
TanStack3mo ago
2 replies
radical-lime

Weird behavior with "useIsMutating" hook

I was playing with this hook and wondering if this is intended:

I fired multiple mutations ( let's say 6 ) with the same scope.id ( to make them queue ) and with onSuccess callback that just logs what useIsMutating returns.
So I am getting a log every time a mutation from the queue is finished, but all my logs are "0" and only the last one logs "1".

If I log the same value outside of the callback I get values from 6 to 1, which is what I would expect.

Codesandbox: https://codesandbox.io/p/sandbox/nv7mlx
Screenshot_2025-10-25_211830.png
Was this page helpful?