Skip to content

fix(useQuery): make sure that disabled queries in error state don't throw - #2933

Merged
TkDodo merged 1 commit into
TanStack:masterfrom
TkDodo:feature/2930
Nov 12, 2021
Merged

TkDodo merged 1 commit into
TanStack:masterfrom
TkDodo:feature/2930

Conversation

@TkDodo

@TkDodo TkDodo commented Nov 12, 2021

Copy link
Copy Markdown
Collaborator

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

vercel Bot commented Nov 12, 2021 •

Copy link
Copy Markdown

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
Copy Markdown

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

codecov Bot commented Nov 12, 2021 •

Copy link
Copy Markdown

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

TkDodo commented Nov 12, 2021

Copy link
Copy Markdown
Collaborator Author

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

@WeiShengv99

Copy link
Copy Markdown

@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
Copy Markdown
Member

🎉 This PR is included in version 3.32.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

This branch was successfully deployed

1 active deployment
Preview — 16baba41 Deployed Nov 12, 2021 by vercel[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