The previous error in onError #1722
Unanswered
andrewslock
asked this question in
Q&A
Replies: 1 comment 5 replies
-
If you want to refetch in case you get a certain error, you can implement the |
Beta Was this translation helpful? Give feedback.
5 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.
-
I am not sure whether it's supposed to be so or it's a bag.
I am using a useQuery hook with my fetch function that can throw an error. I handle it like this:
onError: (err) => { if (err instanceof MyError) refetch(); }
But once the error has been thrown and I am trying to cancel the refetching query with
queryClient.cancelQueries()
onError
fires again with the same error so it breaks the logic of my handler.Isn't it supposed to be CancelledError or something? Why does it return the same error gotten in the previous failed fetch?
Beta Was this translation helpful? Give feedback.
All reactions