Defined in: packages/query-core/src/mutationCache.ts:26
Global callbacks that fire for every mutation handled by a MutationCache, regardless of which component or observer triggered it. They differ from the defaultOptions provided to a QueryClient in two ways: defaultOptions can be overridden by each mutation, while these callbacks are always called, and onMutate here does not allow returning a result.
If a callback returns a promise, it will be awaited before the mutation continues.
optional onError: (error, variables, onMutateResult, mutation, context) => unknown;Defined in: packages/query-core/src/mutationCache.ts:28
Called when any mutation in the cache encounters an error.
Error
unknown
unknown
Mutation<unknown, unknown, unknown>
unknown
optional onMutate: (variables, mutation, context) => unknown;Defined in: packages/query-core/src/mutationCache.ts:44
Called before any mutation in the cache executes.
unknown
Mutation<unknown, unknown, unknown>
unknown
optional onSettled: (data, error, variables, onMutateResult, mutation, context) => unknown;Defined in: packages/query-core/src/mutationCache.ts:50
Called when any mutation in the cache is settled, either successfully or with an error.
unknown
Error | null
unknown
unknown
Mutation<unknown, unknown, unknown>
unknown
optional onSuccess: (data, variables, onMutateResult, mutation, context) => unknown;Defined in: packages/query-core/src/mutationCache.ts:36
Called when any mutation in the cache is successful.
unknown
unknown
unknown
Mutation<unknown, unknown, unknown>
unknown