Class MutationOptions<TVariables, TData>
- Namespace
- Velvet
- Assembly
- Velvet.Docs.dll
Options passed to UseMutation<TVariables, TData>(MutationOptions<TVariables, TData>). The MutationFn is the async function invoked by Mutate(TVariables) / MutateAsync(TVariables). For a value carried from before the call to its callbacks, use MutationOptions<TVariables, TData, TContext>. Each callback returns a task the call waits for before the next stage, as TanStack Query awaits the promise its callbacks return; a callback with nothing to wait for returns CompletedTask.
public sealed record MutationOptions<TVariables, TData>
Type Parameters
TVariablesTData
- Inheritance
-
objectMutationOptions<TVariables, TData>
Constructors
- MutationOptions(Func<TVariables, CancellationToken, VelvetTask<TData>>, Func<TData, TVariables, VelvetTask>?, Func<Exception, TVariables, VelvetTask>?)
Options passed to UseMutation<TVariables, TData>(MutationOptions<TVariables, TData>). The MutationFn is the async function invoked by Mutate(TVariables) / MutateAsync(TVariables). For a value carried from before the call to its callbacks, use MutationOptions<TVariables, TData, TContext>. Each callback returns a task the call waits for before the next stage, as TanStack Query awaits the promise its callbacks return; a callback with nothing to wait for returns CompletedTask.
Properties
- OnSettled
Runs after OnSuccess or OnError, with the data and a null exception on success and default data and the exception on failure.
- Retry
Retries a failed MutationFn within the same call: Status, Data and Error stay uncommitted between attempts while FailureCount, FailureReason and IsPaused follow them, and OnSuccess / OnError / OnSettled run once, for the last attempt's outcome. When null, the default, a failure is not retried, as TanStack Query's mutations default to
retry: 0.