createTransitionHold
Creates the hold of a value a transition builds (see TransitionHold): the reads that wait for data inside hold.run(...) count against this hold instead of the Suspense boundary around the value, so the value on screen stays until the new one is ready.
Creates the hold of a value a transition builds (see TransitionHold): the reads that wait
for data inside hold.run(...) count against this hold instead of the Suspense boundary around the
value, so the value on screen stays until the new one is ready. For renderers that build values
during a transition.
Import#
ts
import { createTransitionHold } from "@shadow-js/core/extend";
Signature#
ts
function createTransitionHold(onSettled: () => void): TransitionHold | null
Parameters#
| Name | Description |
|---|---|
onSettled |
Called each time the number of waiting reads drops back to zero. |
Returns#
The hold, or null when the transition machinery does not exist yet (no transition has run, so nothing can be held).
Examples#
ts
import { createTransitionHold } from "@shadow-js/core/extend";
const hold = createTransitionHold(() => console.log("ready to commit"));
const built = hold === null ? "now" : hold.run(() => "pending");