Performance: Hydration behavior
Hydration affects how quickly a server-rendered Vue app becomes interactive on the client side.
const app = createSSRApp(App); app.mount('#app'); // lazy hydrate parts or use partial hydration
const app = createSSRApp(App); app.mount('#app'); // full hydration of entire app immediately
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Full hydration of entire app | High (all nodes processed) | Multiple reflows during hydration | High paint cost due to updates | [X] Bad |
| Partial or lazy hydration | Lower (only interactive parts) | Fewer reflows | Lower paint cost | [OK] Good |
const app = createSSRApp({
data() { return { count: 0 } },
mounted() { console.log('Mounted with count:', this.count) }
})
app.mount('#app')v-if or v-show to render client-only content after hydration avoids mismatch.v-if or v-show to conditionally render client-only parts after hydration -> Option DPass the test and this pattern moves unknown