Skip to content
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(useQuery): don't throw error if errorBoundary has just been reset #2935

Merged

Conversation

TkDodo
Copy link
Collaborator

@TkDodo TkDodo commented Nov 12, 2021

the fix for disabled queries was wrong, because disabled queries still need to throw if they are fetching due to some other means, like refetch. However, if a query has just been reset, we want to skip throwing for one render cycle. The useEffect that clears the reset will then make sure that further errors will be thrown

the fix for disabled queries was wrong, because disabled queries still need to throw if they are fetching due to some other means, like `refetch`. However, if a query has just been reset, we want to skip throwing for one render cycle. The useEffect that clears the reset will then make sure that further errors will be thrown
@vercel
Copy link

vercel bot commented Nov 12, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/tanstack/react-query/5WWq937PQ59BjwFADxoPoNK57TYt
✅ Preview: https://react-query-git-fork-tkdodo-feature-disabled-qu-56a4aa-tanstack.vercel.app

@codesandbox-ci
Copy link

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 df2ea39:

Sandbox Source
tannerlinsley/react-query: basic Configuration
tannerlinsley/react-query: basic-typescript Configuration

@codecov
Copy link

codecov bot commented Nov 12, 2021

Codecov Report

Merging #2935 (df2ea39) into master (d3d7fc4) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2935   +/-   ##
=======================================
  Coverage   96.40%   96.40%           
=======================================
  Files          45       45           
  Lines        2227     2227           
  Branches      637      637           
=======================================
  Hits         2147     2147           
  Misses         77       77           
  Partials        3        3           
Impacted Files Coverage Δ
src/react/useBaseQuery.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d3d7fc4...df2ea39. Read the comment docs.

@TkDodo
Copy link
Collaborator Author

TkDodo commented Nov 12, 2021

@WeiShengv99 I tried your lates example with this preview, and it seems to work fine:

https://codesandbox.io/s/tannerlinsley-react-query-basic-forked-vspe0?file=/src/index.js

@TkDodo TkDodo merged commit 2c36b6d into TanStack:master Nov 12, 2021
@TkDodo TkDodo deleted the feature/disabled-queries-and-use-error-boundary branch November 12, 2021 21:11
@tannerlinsley
Copy link
Collaborator

🎉 This PR is included in version 3.32.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@WeiShengv99
Copy link

WeiShengv99 commented Nov 13, 2021

@WeiShengv99 I tried your lates example with this preview, and it seems to work fine:

codesandbox.io/s/tannerlinsley-react-query-basic-forked-vspe0?file=/src/index.js

Yes, this pr fixed my problem.
By the way , i have some question about this behavior .

enable:false instance get cache data in second component, sometimes i dont know i have cache , before i set enable:true, i thought i get data is undefined, but i got a queryInstance's status is successed , this is a litter confusing ,
what do you think about that , its right now ?

if enable:false cant get cache data , the throw error problem also fixed.

--------------------------------------update---
its seems like design with disabling-queries

i find your explanation about why sync the data

Thank you! i know what should i do now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants