refactor(query-core)!: create mutation caches on demand #12685
🎯 Changes#
- Use the exported
getMutationCache(queryClient)function in place ofqueryClient.getMutationCache(). The core client creates its default cache on first access. Injected caches and Vue Query's default Vue-aware cache still work. - Simplify mutation scope lookup and removal. Each scope keeps its own ordered queue.
- Update adapters, Devtools, and persistence to use the new accessor. Test that reading mutation state, dehydrating, resuming, and clearing an unused client leave the cache uninitialized.
With pnpm test:size, React minimal drops from 8,396 B to 8,066 B. React full grows from 12,694 B to 12,723 B and stays 277 B under its limit.
✅ Checklist#
- I have followed the steps in the Contributing guide.
- I have tested code changes locally with
pnpm run test:pr, or these tests do not apply to this pull request. - I have followed the AI contribution policy and fully understand the code in this pull request, including any code generated with AI assistance.
🚀 Release Impact#
- This change affects published code, and I have generated a changeset.
- This change is docs/CI/dev-only (no release).
- 1
Important
Draft PR not reviewed#
Draft PRs are not automatically reviewed by default.
- Trigger a manual review
To automatically review draft PRs, update your CodeRabbit configuration:
reviews: auto_review: drafts: true- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
View your CI Pipeline Execution ↗ for commit 1f80109047d5233333fba4c7cf2f3c9a4d212a22
Command Status Duration Result nx affected --targets=test:sherif,test:knip,tes...✅ Succeeded 8m 28s View ↗ nx run-many --target=build --exclude=examples/*...✅ Succeeded 35s View ↗
☁️ Nx Cloud last updated this comment at
2026-11-23 12:45:38UTCTkDodo closed this
size-limit report 📦#
Path Size react full 12.42 KB (+0.23% 🔺) react minimal 7.88 KB (-3.94% 🔽) 🚀 Changeset Version Preview#
23 package(s) bumped directly, 2 bumped as dependents.
🟥 Major bumps#
Package Version Reason @tanstack/angular-query5.108.3 → 6.0.0 Changeset @tanstack/angular-query-devtools5.108.3 → 6.0.0 Changeset @tanstack/eslint-plugin-query5.108.3 → 6.0.0 Changeset @tanstack/lit-query0.2.43 → 1.0.0 Changeset @tanstack/preact-query5.108.3 → 6.0.0 Changeset @tanstack/preact-query-devtools5.108.3 → 6.0.0 Changeset @tanstack/preact-query-persist-client5.108.3 → 6.0.0 Changeset @tanstack/query-async-storage-persister5.108.3 → 6.0.0 Changeset @tanstack/query-broadcast-client-experimental5.108.3 → 6.0.0 Changeset @tanstack/query-core5.108.3 → 6.0.0 Changeset @tanstack/query-devtools5.108.3 → 6.0.0 Changeset @tanstack/query-persist-client-core5.108.3 → 6.0.0 Changeset @tanstack/react-query5.108.3 → 6.0.0 Changeset @tanstack/react-query-devtools5.108.3 → 6.0.0 Changeset @tanstack/react-query-next-experimental5.108.3 → 6.0.0 Changeset @tanstack/react-query-persist-client5.108.3 → 6.0.0 Changeset @tanstack/solid-query5.108.3 → 6.0.0 Changeset @tanstack/solid-query-devtools5.108.3 → 6.0.0 Changeset @tanstack/solid-query-persist-client5.108.3 → 6.0.0 Changeset @tanstack/svelte-query6.4.6 → 7.0.0 Changeset @tanstack/svelte-query-devtools6.4.6 → 7.0.0 Changeset @tanstack/vue-query5.108.3 → 6.0.0 Changeset @tanstack/vue-query-devtools6.4.6 → 7.0.0 Changeset @tanstack/angular-query-persist-client5.108.3 → 6.0.0 Dependent @tanstack/svelte-query-persist-client6.4.6 → 7.0.0 Dependent
Sign in to join this conversation.
🦋 Changeset detected#
Latest commit: 1f80109047d5233333fba4c7cf2f3c9a4d212a22
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 25 packages
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR