Table of Contents

Class MutateOptions<TVariables, TData>

Namespace
Velvet
Assembly
Velvet.Docs.dll

The cancellation token and callbacks passed to one Mutate(TVariables, MutateOptions<TVariables, TData>?) or MutateAsync(TVariables, MutateOptions<TVariables, TData>?) call: TanStack Query's mutate(variables, { onSuccess, onError, onSettled }). The callbacks run after the hook options' own callbacks, once the call's outcome is on the handle, and only while the component is mounted and the call is still the one the handle follows: the component unmounting, a newer call starting and Reset() each drop them. Every context parameter is the call's OnMutate result boxed, and null for the context-free option records.

public sealed record MutateOptions<TVariables, TData>

Type Parameters

TVariables
TData
Inheritance
object
MutateOptions<TVariables, TData>

Properties

CancellationToken

The token the call's mutation function receives. Nothing but the caller cancels it: unmounting the component, a newer call and Reset() leave a call running, as TanStack Query v5's mutation never cancels. A function that honours a cancelled token ends in the exception, which fails the call like any other.

OnError

Runs when the call fails.

OnSettled

Runs after OnSuccess or OnError, with the data and a null exception on success and default data and the exception on failure.

OnSuccess

Runs when the call succeeds.