fix(react-query): retry queries with falsy errors on mount - #11328
fix(react-query): retry queries with falsy errors on mount#11328jeonghoon11 wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe retry prevention logic now checks query status instead of error truthiness. A regression test verifies remount retries for a falsy rejected error. A patch changeset documents the behavior. ChangesFalsy error retry behavior
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This change restores retry-on-remount behavior when queries reject with falsy errors and the configured error policy allows retrying. No actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (1 skipped: 1 unsupported.) Full details: Description checkExplanation The description explains the cause, implementation, regression coverage, checklist status, and release impact. The test checklist item is unchecked, but the description is otherwise complete and includes a generated changeset.
✨ 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 |
Fixes #11327
🎯 Changes
When a query rejected with a falsy value such as
undefined,ensurePreventErrorBoundaryRetrydid not evaluate the function-valuedthrowOnErroroption because it checked the truthiness ofquery.state.error.The callback function itself was then treated as truthy, causing
retryOnMountto be set tofalseeven whenthrowOnErrorwould returnfalse.This change checks
query.state.status === 'error'instead, ensuring that thethrowOnErrorcallback is evaluated for all query errors, including falsy ones.A regression test verifies that a query rejecting with
undefinedretries after remounting whenthrowOnErrorreturnsfalse.✅ Checklist
pnpm run test:pr, or these tests do not apply to this pull request.🚀 Release Impact
Summary by CodeRabbit
Bug Fixes
throwOnError: falsetogether withretryOnMount: true, ensuring failed queries can retry as configured.Release
@tanstack/react-query.