fix(query-core): refetch resetQueries matches after state-mutating reset - #11199
fix(query-core): refetch resetQueries matches after state-mutating reset#11199MHJahanbakhsh wants to merge 1 commit into
Conversation
Snapshot the matched query set before reset() so state-dependent filters (e.g. status === 'error') still refetch the intended queries. Fixes TanStack#10705
|
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)
Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review. 📝 WalkthroughWalkthrough
ChangesresetQueries predicate handling
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This change preserves the queries matched before reset so state-dependent filters are refetched as intended; the localized behavior fix and regression coverage leave no actionable merge-blocking risk beyond normal checks and review. Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
Summary
resetQuerieswith a state-dependent filter (e.g.predicate: (query) => query.state.status === 'error') reset the matched queries but never refetched them.reset()mutates query state beforerefetchQueriesre-ran the same filters, so the intended queries no longer matched and stayed stuck inpending.filters.type, defaulting toactive).Test plan
pnpm --filter @tanstack/query-core exec vitest run src/__tests__/queryClient.test.tsx -t resetQueries(5 passed)Summary by CodeRabbit
resetQueriesso state-based filters are evaluated before queries are reset.