onSuccess options of mutate is not called. #5604
Unanswered
moonkorea00
asked this question in
Q&A
Replies: 2 comments 4 replies
-
https://tkdodo.eu/blog/mastering-mutations-in-react-query#some-callbacks-might-not-fire |
Beta Was this translation helpful? Give feedback.
2 replies
-
I'm seeing this behavior, but when the same mutation is called twice in parallel. I have one call that is used as a debounced save draft, and then a real save. If both get invoked simultaneously react query gets in a bad status, and the isLoading value is stuck "true". |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey team,
I'm currently having a situation where the onSuccess within the mutate is not called.
The code to reproduce the same result is as following :
the result i was expecting when 'someFunction' is called was :
however, the output is :
when using mutateAsync like how it is used below, the expected results are logged :
To sum up, the onSuccess declared right after mutate is not ran despite a successful api call using mutate. Only the onSuccess of the custom hook is ran. No errors are caught running the functions.
My understanding is that the onSuccess option is not overrided. What might be the cause of the issue i'm facing?
Beta Was this translation helpful? Give feedback.
All reactions