Prevent refetchOnMount if the loader / clientLoader prefetched an error #9839
Unanswered
GitonioDev
asked this question in
Q&A
Replies: 1 comment 4 replies
-
|
Beta Was this translation helpful? Give feedback.
4 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.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello guys im on remix with react query and i want that if the clientLoader prefetches an errored query the query inside the component will not refetchOnMount, this only happens if i had a query with data, it directly refetches it after the clientLoader just prefetched an error, if i set refetchOnMount conditionally to false then it does work -> it will not refetch, but then any behavoir that comes from refetchOnMount is gone like if an error boundary is reset or something the query wont refetch automatically. So here is a showcase:
queryKey: "checkout-session" -> clientLoader (prefetchQuery) -> query.state.error.status = 400 -> useQuery mounts refetchOnMount triggers because data was not updated by the prefetchQuery and data is considered stale: double fetch on error
Beta Was this translation helpful? Give feedback.
All reactions