Struct TransitionStarter
- Namespace
- Velvet
- Assembly
- Velvet.Docs.dll
The startTransition function returned by UseTransition(). Accepts
either a synchronous callback (startTransition(() => ...)) or
an async one (startTransition(async () => ...)). The state updates the callback schedules
before it first suspends are put on the Transition lane, whichever component owns the state they
write; for the async form, isPending stays true across awaits until the task completes, while
the updates the action makes after an await that suspended it fall outside the scope this call
opened — wrap them in a further startTransition to put them back in it. An await of a
task that had already completed does not suspend, so what follows it is still inside the scope; the
migration guide's useTransition row owns that rule. Nested calls join the outer transition.
public readonly struct TransitionStarter
Remarks
A struct (no allocation) wrapping the two cached closures built once per render slot. Reference-stable, so placing a TransitionStarter in a dependency array does not spuriously change it.
Methods
- Equals(object?)
Indicates whether this instance and a specified object are equal.
- Equals(TransitionStarter)
Value equality over the two wrapped (reference-stable) delegates.
- GetHashCode()
Returns the hash code for this instance.
- Invoke(Action)
Runs
updatesat Transition priority.
- Invoke(Func<VelvetTask>)
Runs
asyncUpdatesat Transition priority up to the point it first suspends, keepingisPendingtrue across awaits until it completes. The updates it makes past a suspension need a furtherstartTransitionto be part of the transition.
Operators
- implicit operator Action<Action>(TransitionStarter)
Implicit conversion to System.Action<T> so the starter can be stored in / passed as an
Action<Action>(the synchronous form). The returned delegate is the cached starter.