Repository navigation
fix(useQuery): make sure that disabled queries in error state don't throw - #2933
Conversation
…hrow because if they would, you would just go directly to the ErrorBoundary again
|
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/tanstack/react-query/77xYDR47WSPt9QvL6Tzbou6ydGC8 |
|
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:
|
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
|
@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🎉 |
|
🎉 This PR is included in version 3.32.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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, withuseErrorBoundary, 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 useenabled, that's what you get. This behaviour is documented with a separate test.