-
| I have a mutation that gets stuck in loading status after the mutation function throws an error, but it only gets stuck if I provide an onError function. The onError function shows a notification in an ancestor component using the following code. I thought about creating an issue, but I haven't been able to make a minimal-complete-verifiable-example yet. One interesting thing to note is that when I tried making a code sandbox to reproduce the issue, it crashes the page, but when the error is thrown in my app. It doesn't crash, with and without the onError. I'm using rails-ranger (Axios) for api requests. I don't know if that would make a difference on the error behavior. This behavior happened in v2. I upgraded the mutations to react-query v3, loading status is still stuck. Does anyone have any ideas why the loading status would be stuck when I include onError, or why the error doesn't crash the page? I thought I might be handling the error in a catch somewhere, but it doesn't crash without onError too. Is there something in Axios that prevents an error response from crashing the page? | 
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 12 replies
-
| am I reading this correctly that the above code is your  | 
Beta Was this translation helpful? Give feedback.
-
| @TkDodo | 
Beta Was this translation helpful? Give feedback.
am I reading this correctly that the above code is your
onErrorhandler foruseMutation? If so, I don't quite understand why you would throw inside that error handler? That shouldn't be necessary - react-query knows about your error already, you can show the notification inonError, and you would still see the error + error status in the mutation...