Defined in: packages/query-core/src/types.ts:1218
TData = unknown
TError = DefaultError
TVariables = void
TOnMutateResult = unknown
| Property | Type | Default value | Description |
|---|---|---|---|
| gcTime? | number | undefined | The time in milliseconds that an unused/inactive mutation remains in memory before it is garbage collected. Defaults to 5 * 60 * 1000 (5 minutes), or Infinity during SSR. |
| meta? | Record<string, unknown> | undefined | - |
| mutationFn? | (variables: TVariables, context: MutationFunctionContext) => Promise<TData> | undefined | - |
| mutationKey? | readonly unknown[] | undefined | - |
| networkMode? | "online" | "always" | "offlineFirst" | 'online' | Controls whether a mutation is allowed to run based on the current network connectivity. See Network Mode for more information. |
| onError? | (error: TError, variables: TVariables, onMutateResult: TOnMutateResult | undefined, context: MutationFunctionContext) => unknown | undefined | - |
| onMutate? | (variables: TVariables, context: MutationFunctionContext) => TOnMutateResult | Promise<TOnMutateResult> | undefined | - |
| onSettled? | (data: TData | undefined, error: TError | null, variables: TVariables, onMutateResult: TOnMutateResult | undefined, context: MutationFunctionContext) => unknown | undefined | - |
| onSuccess? | (data: TData, variables: TVariables, onMutateResult: TOnMutateResult, context: MutationFunctionContext) => unknown | undefined | - |
| retry? | | number | false | true | (failureCount: number, error: TError) => boolean | 0 | If false, failed mutations will not retry by default. If true, failed mutations will retry infinitely. If set to an integer number, e.g. 3, failed mutations will retry until the failed mutation count meets that number. If set to a function (failureCount, error) => boolean failed mutations will retry until the function returns false. |
| retryDelay? | number | (failureCount: number, error: TError) => number | undefined | This function receives a retryAttempt integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. Defaults to a function that applies exponential backoff, capped at 30 seconds. |
| scope? | MutationScope | undefined | - |