useSsrBoot

Commons
stable

Defers CSS transitions until after the first browser paint to prevent flash-of-transition on SSR hydration. Returns an isBooted flag (false during SSR and the first rAF frame, then true) and a ssrBootStyles computed that injects `transition: none !important` while booting, suppressing unwanted entry animations during hydration.

API

Signature

Signature TypeScript complète extraite du fichier du composable.

typescript

useSsrBoot uses requestAnimationFrame to defer the booted flag — it fires after the browser has painted the first frame, ensuring transitions are already in their final CSS state before they are re-enabled.

API

Valeurs de retour

Propriétés et méthodes exposées par l'objet retourné par le composable.

ssrBootStyles
An object `{ transition: "none !important" }` when the component has not yet booted, or an empty array after the first animation frame. Spread onto the root element via :style to suppress hydration-flash transitions.
isBooted
False on the server and during the first rAF after mount, true thereafter. Useful as a guard before running DOM-dependent logic that assumes the component is fully hydrated.

Usage

Exemples

Extraits de code prêts à coller.

Suppress hydration-flash on a slide-in panel

vue

Gate DOM-dependent logic on isBooted

vue