Performance: Svelte components in Astro
MEDIUM IMPACT
This affects page load speed and interaction responsiveness by how Svelte components are hydrated and rendered within Astro pages.
--- import MyWidget from '../components/MyWidget.svelte'; --- <html> <body> <MyWidget client:idle /> <MyWidget client:idle /> <MyWidget client:idle /> </body> </html>
--- import MyWidget from '../components/MyWidget.svelte'; --- <html> <body> <MyWidget client:load /> <MyWidget client:load /> <MyWidget client:load /> </body> </html>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| client:load on many components | Multiple hydration scripts | Multiple reflows during hydration | High paint cost due to JS blocking | [X] Bad |
| client:idle on many components | Same DOM but deferred hydration | Single reflow after idle hydration | Lower paint cost, smoother interaction | [OK] Good |