Navigation Menu

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): make sure that disabled queries in error state don't throw #2933

Merged
merged 1 commit into from Nov 12, 2021

Conversation

TkDodo
Copy link
Collaborator

@TkDodo TkDodo commented Nov 12, 2021

fixes #2930

one caveat is that the disabled query will be rendered with status: 'error', because that's the state the query is in. Usually, with useErrorBoundary, you'd expect to never see a query in error state. However, I think disabled queries can be in all resolved states (success, error, idle), so if you use enabled, that's what you get. This behaviour is documented with a separate test.

…hrow

because if they would, you would just go directly to the ErrorBoundary again
@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/77xYDR47WSPt9QvL6Tzbou6ydGC8
✅ Preview: https://react-query-git-fork-tkdodo-feature-2930-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 16baba4:

Sandbox Source
tannerlinsley/react-query: basic Configuration
tannerlinsley/react-query: basic-typescript Configuration
affectionate-chaum-e81vu Issue #2930

@codecov
Copy link

codecov bot commented Nov 12, 2021

Codecov Report

Merging #2933 (16baba4) into master (3534621) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2933   +/-   ##
=======================================
  Coverage   96.40%   96.40%           
=======================================
  Files          45       45           
  Lines        2226     2227    +1     
  Branches      636      637    +1     
=======================================
+ Hits         2146     2147    +1     
  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 3534621...16baba4. Read the comment docs.

@TkDodo
Copy link
Collaborator Author

TkDodo commented Nov 12, 2021

@WeiShengv99 FYI, please have a look at the codesandbox preview build. The sandbox you posted seems to work with this fix.

@WeiShengv99
Copy link

@WeiShengv99 FYI, please have a look at the codesandbox preview build. The sandbox you posted seems to work with this fix.

yeah,its look good for me,tks🎉

@TkDodo TkDodo merged commit d3d7fc4 into TanStack:master Nov 12, 2021
@TkDodo TkDodo deleted the feature/2930 branch November 12, 2021 13:34
@tannerlinsley
Copy link
Collaborator

🎉 This PR is included in version 3.32.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

QueryErrorResetBoundary not rest when i have enabled option
3 participants