feat(query-core): pass failureCount to QueryCache onError callback#10773
feat(query-core): pass failureCount to QueryCache onError callback#10773n-satoshi061 wants to merge 1 commit into
Conversation
Adds a third `failureCount` parameter to `QueryCacheConfig.onError`, indicating how many retry attempts occurred before the final failure (0 = no retries). Enables differentiated error handling without needing to derive the count from `query.state.fetchFailureCount`. Closes TanStack#10713 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.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 (4)
📝 WalkthroughWalkthroughThe PR extends the ChangesQuery onError Callback with Retry Count
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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
Closes #10713.
Adds a third
failureCountparameter toQueryCacheConfig.onError, indicating how many retry attempts occurred before the final failure:0— the initial attempt failed (no retries happened)n—nretries were exhausted before giving upThis makes it easy to implement differentiated error handling without having to derive the count from
query.state.fetchFailureCount:The value is consistent with the
failureCountconvention already used inShouldRetryFunctionandRetryDelayFunction.Test plan
onErrortest to assertfailureCount = 0when no retries occurfailureCountequals the configuredretrycount when retries are exhausted@tanstack/query-coretests pass (527 tests)@tanstack/react-querytests pass (542 tests)🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
failureCountparameter indicating the number of retry attempts before the final error occurred. A value of 0 means no retries were attempted. This enables conditional error handling logic based on retry behavior.