Replies: 1 comment 1 reply
-
https://stackblitz.com/edit/tanstack-query-hnpf3s?file=src%2Findex.jsx Okay, as I checked in this example with latest versions of tanstack query - everything working as expected about resetting error when But when we handle errors using QueryErrorBoudaryReset, our error will still remain when we call Is this expected behavior or I can create issue? |
Beta Was this translation helpful? Give feedback.
1 reply
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 remember that in version 4 of React Query the refreshing functionality worked as follows:
isError: true
staterefetch
of this query, it was again assigned theisLoading
state, reset error state and I could display, for example, the loader again instead of displaying the error.As far as I can see now, this behavior has changed and now the
refetch
call will not reset the query’s state to “initial loading” and will not reset the error for this query if it sees that the query does not have data.Correct me - is this true?
And if so, then what would be the best way to handle such a case?
I use QueryErrorResetBoundary with ErrorBoundary and put function in query where I check if this is first loading - then I just throw error to the boundary. In my boundary I have button to reload again.
But because of React Native - I want to give the user possibility to refetch errored query by "Pull to refresh" functionality.
Beta Was this translation helpful? Give feedback.
All reactions