Defined in: packages/vue-query/src/mutationCache.ts:15
Vue-aware subclass of @tanstack/query-core's MutationCache. find/findAll also accept a MaybeRefDeep filters object, so refs can be passed directly without unwrapping. Access it via queryClient.getMutationCache() — QueryClient constructs one of these by default.
MutationCache
new MutationCache(config): MutationCache;Defined in: packages/query-core/src/mutationCache.ts:129
MutationCacheConfig = {}
MutationCache
MC.constructorconfig: MutationCacheConfig = {};Defined in: packages/query-core/src/mutationCache.ts:129
MC.configprotected listeners: Set<MutationCacheListener>;Defined in: packages/query-core/src/subscribable.ts:2
MC.listenersclear(): void;Defined in: packages/query-core/src/mutationCache.ts:236
Removes all mutations from the cache.
void
const mutationCache = queryClient.getMutationCache()
mutationCache.clear()MC.clearfind<TData, TError, TVariables, TOnMutateResult>(filters):
| Mutation<TData, TError, TVariables, TOnMutateResult>
| undefined;Defined in: packages/vue-query/src/mutationCache.ts:16
A slightly more advanced method that can be used to get an existing mutation instance from the cache. If the mutation does not exist, undefined is returned.
This is not typically needed for most applications, but can come in handy when needing more information about a mutation in rare scenarios.
TData = unknown
TError = Error
TVariables = any
TOnMutateResult = unknown
MaybeRefDeep<MutationFilters<unknown, Error, unknown, unknown>>
| Mutation<TData, TError, TVariables, TOnMutateResult> | undefined
const mutationCache = queryClient.getMutationCache()
const mutation = mutationCache.find({ mutationKey: ['addPost'] })MC.findfindAll(filters): Mutation<unknown, Error, unknown, unknown>[];Defined in: packages/vue-query/src/mutationCache.ts:27
An even more advanced method that can be used to get existing mutation instances from the cache that match the given filters. If no mutations match, an empty array is returned.
This is not typically needed for most applications, but can come in handy when needing more information about mutations in rare scenarios.
MaybeRefDeep<MutationFilters<unknown, Error, unknown, unknown>> = {}
Mutation<unknown, Error, unknown, unknown>[]
const mutationCache = queryClient.getMutationCache()
const mutations = mutationCache.findAll({ mutationKey: ['addPost'] })MC.findAllgetAll(): Mutation<unknown, Error, unknown, unknown>[];Defined in: packages/query-core/src/mutationCache.ts:259
Returns all mutations within the cache.
This is not typically needed for most applications, but can come in handy when needing more information about a mutation in rare scenarios.
Mutation<unknown, Error, unknown, unknown>[]
const mutationCache = queryClient.getMutationCache()
const mutations = mutationCache.getAll()MC.getAllhasListeners(): boolean;Defined in: packages/query-core/src/subscribable.ts:19
boolean
MC.hasListenersprotected onSubscribe(): void;Defined in: packages/query-core/src/subscribable.ts:23
void
MC.onSubscribeprotected onUnsubscribe(): void;Defined in: packages/query-core/src/subscribable.ts:27
void
MC.onUnsubscribesubscribe(listener): () => void;Defined in: packages/query-core/src/subscribable.ts:8
MutationCacheListener
(): void;void
MC.subscribe