jotaijs/jotai-tanstack-query
How to reset atom to loading state after reseting an error boundary
Aperta
#32 aperta il 26 apr 2023
help wanted
Metriche repository
- Star
- (287 stelle)
- Metriche merge PR
- (Metriche PR in attesa)
Descrizione
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?