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

MutateOptions.md

37 lines1.7 KB

1---
2id: MutateOptions
3title: MutateOptions
4---
5​
6<!-- DO NOT EDIT: this page is autogenerated from the type comments -->
7​
8Defined in: [packages/query-core/src/types.ts:2013](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L2013)
9​
10The callbacks that can be passed to `mutate` for a single call. They run after the callbacks of
11the mutation options.
12​
13## Type Parameters
14​
15### TData
16​
17`TData` = `unknown`
18​
19### TError
20​
21`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
22​
23### TVariables
24​
25`TVariables` = `void`
26​
27### TOnMutateResult
28​
29`TOnMutateResult` = `unknown`
30​
31## Properties
32​
33| Property | Type | Description |
34| ------ | ------ | ------ |
35| <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. |
36| <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. |
37| <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. |