client:idle in Astro?client:idle for hydration. What is the expected behavior of this component in the browser?<MyComponent client:idle />
The client:idle directive tells Astro to wait until the browser is idle before hydrating the component. This means the component does not hydrate immediately on page load but waits for the browser to finish higher priority tasks.
client:idle in Astroclient:idle in Astro?The correct syntax uses a colon between client and idle without quotes or dashes.
client:idle?<MyComponent client:idle /> but the component hydrates immediately on page load. What is the most likely cause?<MyComponent client:idle />
If the browser does not support the Idle Callback API, Astro cannot defer hydration and falls back to hydrating immediately.
client:idle affect component state initialization?client:idle hydration, when will its client-side state initialize?<MyComponent client:idle />
With client:idle, the component's client-side JavaScript, including state initialization, runs only when the browser is idle and hydration occurs.
client:idle over client:load in Astro?client:idle instead of client:load for hydrating a component?client:idle defers hydration until the browser is idle, reducing blocking during initial load and improving performance.
