Skip to main content
On this pageConstants

Render

Constants

afterCommit

constsource
/**
 * Completes after the runtime's next render commits. The runtime batches
 * renders to `requestAnimationFrame`, so a Command, Subscription, or other
 * Effect that runs immediately after a dirtying Message would otherwise
 * query the DOM before the matching VDOM patch has applied. Yield this
 * before any DOM read or write whose target was just brought into existence
 * (or moved, or had its attributes changed) by the same Message.
 * 
 * The `Dom` helpers (`focus`, `clickElement`, `scrollIntoView`, etc.)
 * already gate themselves with this internally; reach for `afterCommit`
 * directly when building custom Commands or DOM-observing Subscriptions
 * that need the same guarantee.
 * 
 * When the runtime has a patch outstanding, this waits for that patch and
 * nothing else, so it holds even when the frame renders inside a View
 * Transition and the browser decides when the patch applies. With nothing
 * outstanding the DOM already matches the Model, and this yields one frame
 * to the browser.
 */
const afterCommit: Effect.Effect<void>

afterPaint

constsource
/**
 * Completes after the prior state has been painted to the screen. Waits for
 * the runtime's next commit and then one further animation frame, which
 * resumes once that commit's paint is visible. Use this for CSS transition
 * orchestration where the from-state must be displayed before the to-state
 * changes are applied, otherwise the browser collapses both states into a
 * single frame and the transition does not play.
 */
const afterPaint: Effect.Effect<void>

Stay in the update loop.

New releases, patterns, and the occasional deep dive.


Built with Foldkit.

© 2026 Devin Jameson