Defined in: packages/angular-query-experimental/src/types.ts:224
The options accepted by injectMutation. Same as MutationObserverOptions from @tanstack/query-core, minus the internal _defaulted flag.
TData = unknown
The type your mutation function resolves to.
TError = DefaultError
The type of errors your mutation function may throw.
TVariables = void
The type of the variable passed to mutate/mutateAsync.
TOnMutateResult = unknown
The type returned by onMutate, passed to onSuccess/onError/onSettled as their onMutateResult parameter — useful for optimistic-update rollback data.
optional gcTime: number;Defined in: packages/query-core/src/types.ts:1260
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.
optional meta: Record<string, unknown>;Defined in: packages/query-core/src/types.ts:1263
optional mutationFn: MutationFunction<TData, TVariables>;Defined in: packages/query-core/src/types.ts:1206
OmitKeyof.mutationFnoptional mutationKey: readonly unknown[];Defined in: packages/query-core/src/types.ts:1207
optional networkMode: NetworkMode;Defined in: packages/query-core/src/types.ts:1253
Controls whether a mutation is allowed to run based on the current network connectivity.
Defaults to 'online'.
Network Mode for more information.
optional onError: (error, variables, onMutateResult, context) => unknown;Defined in: packages/query-core/src/types.ts:1218
TError
TVariables
TOnMutateResult | undefined
unknown
OmitKeyof.onErroroptional onMutate: (variables, context) => TOnMutateResult | Promise<TOnMutateResult>;Defined in: packages/query-core/src/types.ts:1208
TVariables
TOnMutateResult | Promise<TOnMutateResult>
OmitKeyof.onMutateoptional onSettled: (data, error, variables, onMutateResult, context) => unknown;Defined in: packages/query-core/src/types.ts:1224
TData | undefined
TError | null
TVariables
TOnMutateResult | undefined
unknown
OmitKeyof.onSettledoptional onSuccess: (data, variables, onMutateResult, context) => unknown;Defined in: packages/query-core/src/types.ts:1212
TData
TVariables
TOnMutateResult
unknown
OmitKeyof.onSuccessoptional retry: RetryValue<TError>;Defined in: packages/query-core/src/types.ts:1239
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.
Defaults to 0.
OmitKeyof.retryoptional retryDelay: RetryDelayValue<TError>;Defined in: packages/query-core/src/types.ts:1246
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.
OmitKeyof.retryDelayoptional scope: MutationScope;Defined in: packages/query-core/src/types.ts:1264
optional throwOnError: boolean | (error) => boolean;Defined in: packages/query-core/src/types.ts:1281
Whether errors should be thrown instead of setting the error property. If set to true, all errors will be thrown to the nearest error boundary. If set to a function, it will be passed the error and should return a boolean indicating whether to throw the error (true) or return it as state (false).
Defaults to false.
OmitKeyof.throwOnError