-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
errors are cached and not reset if the component using useQuery is remounted #468
Comments
I’m looking into this |
🎉 This issue has been resolved in version 1.4.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Thank you for the quick fix. |
Hello, I'm getting the same issue in |
@tannerlinsley I am also getting the same issue in |
Feel free to create a new issue / discussion with a codesandbox that shows the issue, preferably on v3. |
For others facing this issue in |
We just ran into the same issue with This will get us by for now: const { reset } = useQueryErrorResetBoundary();
const queryClient = useQueryClient();
const resetErrors = () => {
queryClient.clear();
reset();
}
return (
<ErrorBoundary onReset={resetErrors} fallbackRender={Fallback}>
{ children }
</ErrorBoundary>
); |
Can you try updating to the latest version please? I remember we had a bug somewhere that was since fixed. Otherwise please open a new issue with a codesandbox reproduction |
Here's an example: https://codesandbox.io/s/elegant-minsky-wwfko?file=/src/index.js
Close the error report window then click "retry". That will remount the Posts component but it will error immediately.
If you uncomment the
queryCache.clear()
it works.I would expect that errors are not cached, or that they're cleared when the component is remounted.
My guess is that since the component never officially mounts, there's some edge case here that isn't accounted for, or that this is an intractable problem and I should just always clear the cache on an error (which may very well be a good idea anyway).
The text was updated successfully, but these errors were encountered: