onSuccess mutation not being called
Hey, I have this mutation which is called when I click a button. Inside the
onSuccess
callback I show a toast to the user telling them that the request was successful. However, when I do a state change before I call the mutation, eg setRequests
the onSuccess
callback never runs, I know this because the console log never appears. But, when I remove the setRequests
it does, there is no visible error in my console. Why does this happen? Is it by design?
1 Reply
This probably goes way beyond the component you've shared given it's a prop. I'd expect you're remounting the component or wiping out the QueryClient somehow