fix(react-query): keep unsubscribed useQueries idle - #11130
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthrough
ChangesuseQueries subscription behavior
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
|
View your CI Pipeline Execution ↗ for commit 700d854
☁️ Nx Cloud last updated this comment at |
Summary
useQueriesresults aligned with the cache whensubscribed: false.@tanstack/react-query.Root cause
useQueriesstopped subscriptions forsubscribed: false, but still assigned_optimisticResults: 'optimistic'to every child observer. An unmounted observer then synthesizedisFetching: trueandfetchStatus: 'fetching'even though it did not run the query function and the cache remained idle.This completes the
useQueriesportion of the fix proposed in #10739. PR #10759 correcteduseBaseQuery, but did not changeuseQueries.Validation
vitest src/__tests__/useQueries.test.tsx— 23 passing tests, including the new regression.test:types:tscurrentisFetching: true/fetchStatus: fetching.Summary by CodeRabbit
Bug Fixes
useQueriesso unsubscribed queries no longer display optimistic fetching states.Tests
Release
@tanstack/react-query.