-
-
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
fix(core): change shouldFetchOptionally
condition
#2556
fix(core): change shouldFetchOptionally
condition
#2556
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/tannerlinsley/react-query/9aHMnSCooAbKNSo9bLf5zZ1EP9zM |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 9b0e0e4:
|
Change this condition to not change the status of result to 'loading' when state.status is 'error' Fixes TanStack#2187
b5686c2
to
464b605
Compare
Change to refer to the previous query value.
Check prevQuery.state.status only when prevOptions.enabled is false
🎉 This PR is included in version 3.19.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
the change in shouldFetchOptionally was introduced in TanStack#2556 to avoid an infinite loop wen using suspense (see TanStack#2187), but it broke the case where we're switching keys between two erroneous queries - they now didn't refetch even though they should this fix scopes the error check to only usages where suspense is turned on, so that we get the same behaviour as in v3.19.4 for non-suspense users, while still having the fix for suspense users
Related issue: #2187
Description
Change
shouldFetchOptionally
condition to not change thestatus
of result toloading
whenstate.status
iserror
.result.isLoading
istrue
in this line whenresult.error != null
createResult
function andshouldFetchOptionally
functionFixes #2187