Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

MutateOptions.md

35 lines1.6 KB

1---
2id: MutateOptions
3title: MutateOptions
4---
5​
6Defined in: [packages/query-core/src/types.ts:2012](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L2012)
7​
8The callbacks that can be passed to `mutate` for a single call. They run after the callbacks of
9the mutation options.
10​
11## Type Parameters
12​
13### TData
14​
15`TData` = `unknown`
16​
17### TError
18​
19`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
20​
21### TVariables
22​
23`TVariables` = `void`
24​
25### TOnMutateResult
26​
27`TOnMutateResult` = `unknown`
28​
29## Properties
30​
31| Property | Type | Description |
32| ------ | ------ | ------ |
33| <a id="property-onerror"></a> `onError?` | (`error`: `TError`, `variables`: `TVariables`, `onMutateResult`: `TOnMutateResult` \| `undefined`, `context`: [`MutationFunctionContext`](../type-aliases/MutationFunctionContext.md)) => `void` | Called when the mutation of this call fails, after the `onError` of the mutation options. |
34| <a id="property-onsettled"></a> `onSettled?` | (`data`: `TData` \| `undefined`, `error`: `TError` \| `null`, `variables`: `TVariables`, `onMutateResult`: `TOnMutateResult` \| `undefined`, `context`: [`MutationFunctionContext`](../type-aliases/MutationFunctionContext.md)) => `void` | Called when the mutation of this call succeeds or fails, after the `onSettled` of the mutation options. |
35| <a id="property-onsuccess"></a> `onSuccess?` | (`data`: `TData`, `variables`: `TVariables`, `onMutateResult`: `TOnMutateResult` \| `undefined`, `context`: [`MutationFunctionContext`](../type-aliases/MutationFunctionContext.md)) => `void` | Called when the mutation of this call succeeds, after the `onSuccess` of the mutation options. |