jotaijs/jotai-tanstack-query
How to reset atom to loading state after reseting an error boundary
Open
#32 opened on Apr 26, 2023
help wanted
Repository metrics
- Stars
- (287 stars)
- PR merge metrics
- (PR metrics pending)
Description
So far I've tried using the QueryErrorResetBoundary (like described here) and calling queryClient.invalidateQueries(...) manually when reseting the error boundary, but the outcome is as follows:
- I shut down my server & reload
- The query fetches, fails, component enters error state, gets caught in error boundary
- I click the fallback "try again" button to reset the error boundary
- The component immediately renders in an error state and fails again
- The query refetches, but doesn't seem to update the atom
- Even after clicking "try again" again the same happens
The error handling example you provide seems to work by changing the user state to a different view where the query doesn't fail. When navigating to the item that causes the error, it immediately fails again. How could we reset the query, so instead of failing the atom tries again and reenters the loading state?