Skip to content
Source
Sign inSign up
TanStack/query

refactor(query-core)!: create mutation caches on demand #12685

ClosedTkDodowants to merge 1 commit intoquery-v6 fromrefs/pull/12685/headopened View on GitHub

Showing 48 changed files with 20 additions and 7 deletions (loading 45).

x
0 of 48 viewed, 48 left
12 additions and 0 deletions.changeset/late-monkeys-cry.mdAdded
View file
@@ -0,0 +1,12 @@
+---
+'@tanstack/angular-query': major
+'@tanstack/lit-query': major
+'@tanstack/preact-query': major
+'@tanstack/query-core': major
+'@tanstack/react-query': major
+'@tanstack/solid-query': major
+'@tanstack/svelte-query': major
+'@tanstack/vue-query': major
+---
+​
+Use the exported `getMutationCache(queryClient)` function in place of `queryClient.getMutationCache()`. The core client creates the default mutation cache on first access, so query-only bundles can omit the cache implementation. A custom cache supplied to the client is still used. Mutation scope operations use the existing scope index with a simpler lookup and removal path.
2 additions and 2 deletionspackages/angular-query/src/__tests__/inject-is-mutating.test.tsModified
View file
@@ -1,6 +1,6 @@
import { Component, input, inputBinding, signal } from '@angular/core'
import { TestBed } from '@angular/core/testing'
-import { Mutation } from '@tanstack/query-core'
+import { Mutation, getMutationCache } from '@tanstack/query-core'
import { createKey, sleep } from '@tanstack/query-test-utils'
import { render } from '@testing-library/angular'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
@@ -105,7 +105,7 @@
}))
​
- const subscribe = vi.spyOn(queryClient.getMutationCache(), 'subscribe')
+ const subscribe = vi.spyOn(getMutationCache(queryClient), 'subscribe')
const includeMutation = signal(true)