fix(react-query): retry fetch on remount when error boundary has not been reset#10962
fix(react-query): retry fetch on remount when error boundary has not been reset#10962EduardF1 wants to merge 2 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesretryOnMount guard and test alignment
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
useQuerywiththrowOnErrorwould refuse to retry on remount even after the error boundary had unmounted and remounted the failed observer — effectively leaving the component stuck in an error state with no recovery path unless the user explicitly reset the boundary.ensurePreventErrorBoundaryRetryinerrorBoundaryUtils.ts: retry is only suppressed when the boundary has not been reset and the query is either usingsuspenseor still has live observers. On a fresh mount (zero observers), the retry suppression is lifted so the remounted component can attempt a new fetch.staleTime: Infinity.Files changed
packages/react-query/src/errorBoundaryUtils.ts— guard loosened to allow remount retrypackages/react-query/src/__tests__/QueryResetErrorBoundary.test.tsx— two new/updated test casesTest plan
pnpm run test:lib -- --run QueryResetErrorBoundaryinpackages/react-query— all 14 tests passpnpm test) — to be run by CI🤖 Generated with Claude Code
Summary by CodeRabbit