mirror of
https://github.com/TanStack/query.git
synced 2026-11-18 19:33:22 +00:00
* chore(scripts/generate-docs): read type alias bodies whose type parameters have defaults * chore(*): update '@tanstack/typedoc-config' to v0.3.5
2.2 KiB
2.2 KiB
| id | title |
|---|---|
| MutationCacheConfig | MutationCacheConfig |
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.
Properties
| Property | Type | Description |
|---|---|---|
onError? |
(error: Error, variables: unknown, onMutateResult: unknown, mutation: Mutation<unknown, unknown, unknown>, context: MutationFunctionContext) => unknown |
Called when any mutation in the cache encounters an error. |
onMutate? |
(variables: unknown, mutation: Mutation<unknown, unknown, unknown>, context: MutationFunctionContext) => unknown |
Called before any mutation in the cache executes. |
onSettled? |
(data: unknown, error: Error | null, variables: unknown, onMutateResult: unknown, mutation: Mutation<unknown, unknown, unknown>, context: MutationFunctionContext) => unknown |
Called when any mutation in the cache is settled, either successfully or with an error. |
onSuccess? |
(data: unknown, variables: unknown, onMutateResult: unknown, mutation: Mutation<unknown, unknown, unknown>, context: MutationFunctionContext) => unknown |
Called when any mutation in the cache is successful. |