Table of Contents

Class MutationResult<TVariables, TData>

Namespace
Velvet
Assembly
Velvet.Docs.dll
public sealed class MutationResult<TVariables, TData>

Type Parameters

TVariables
TData
Inheritance
object
MutationResult<TVariables, TData>

Properties

Data

Result of the most recent call, and default under every status but Success: starting a call clears it, so a pending call never shows an earlier call's result, and a call that fails — its OnSuccess throwing included — leaves none behind.

Error

Exception from the last failed mutation, and null under every other status.

FailureCount

How many attempts of the most recent call have failed, as TanStack's failureCount: zero when a call starts or succeeds, one more for each failed attempt a Retry retries, and one more again when the call fails for good.

FailureReason

The exception of the most recent failed attempt of the call, as TanStack's failureReason: null when a call starts or succeeds, and still the last attempt's failure while the call waits to retry.

IsError

True when the last mutation threw.

IsIdle

True when no mutation has run yet (or it was reset).

IsPaused

True while the call waits for a connection or for the application to become visible again, as TanStack's isPaused. See NetworkMode.

IsPending

True while a mutation is in flight.

IsSuccess

True when the last mutation completed successfully.

Status

Current lifecycle status of the mutation.

Variables

Variables passed to the most recent mutation invocation, or default.

Methods

Mutate(TVariables)

Fire-and-forget mutation that does not return a task.

Mutate(TVariables, MutateOptions<TVariables, TData>?)

Fire-and-forget mutation whose own options callbacks run after the hook options'.

MutateAsync(TVariables)

Awaitable mutation. Rethrows the underlying exception on failure so callers can try / catch; Error is also populated. The call settles the same whether or not the component is still mounted, since unmounting cancels nothing and a call made after the unmount runs.

MutateAsync(TVariables, MutateOptions<TVariables, TData>?)

Awaitable mutation whose own options callbacks run after the hook options'. Settles as MutateAsync(TVariables) does.

Reset()

Resets status to Idle and clears Data / Error / Variables. In-flight mutations are not cancelled by Reset, and they no longer write this handle: a call reset out of runs to completion and delivers its own OnSuccess / OnError / OnSettled, but its outcome is not the one the handle shows.