Incremental Hydration (Default in v22)
Angular 22 enables incremental hydration by default for SSR apps. Components inside @defer blocks with hydrate triggers are server-rendered but only hydrated on the client when the trigger fires , dramatically improving Time to Interactive.
hydrate on immediate
Hydrates as soon as the page loads. Use for above-the-fold content that must be interactive right away.
@defer (hydrate on immediate) {
<app-hero-widget />
}Hydrates when the element scrolls into the viewport. Perfect for below-the-fold content like comments.
@defer (hydrate on viewport) {
<app-comments-widget />
}hydrate on hover
Hydrates when the user hovers over the component. Great for secondary interactive content like dashboards.
@defer (hydrate on hover) {
<app-analytics-widget />
}hydrate on interaction
Hydrates on the first user interaction (click, keydown, etc.). Ideal for chat widgets or forms that only activate on engagement.
@defer (hydrate on interaction) {
<app-chat-widget />
}hydrate on timer(2s)
Hydrates after a specified delay. Useful for low-priority widgets that should eventually become interactive.
@defer (hydrate on timer(2s)) {
<app-newsletter-widget />
}Configuration
- Default in Angular 22 —
provideClientHydration()now includes incremental hydration automatically. No opt-in needed. withIncrementalHydration()— Deprecated since v22. Intent to remove in v24.withNoIncrementalHydration()— Use this to opt out and revert to full hydration behavior.- Available triggers:
hydrate on immediate,hydrate on viewport,hydrate on hover,hydrate on interaction,hydrate on timer(ms),hydrate on idle,hydrate when condition,hydrate never. - SSR + Event Replay — Combine with
withEventReplay()to capture user events before hydration completes and replay them after. - TTI improvement — Only the visible/needed components hydrate on load, reducing JavaScript execution and improving Time to Interactive.
// Angular 22 app.config.ts , incremental hydration is ON by default
export const appConfig: ApplicationConfig = {
providers: [
provideClientHydration(withEventReplay()),
// That's it! No withIncrementalHydration() needed.
],
};
Incremental hydration is amazing!
My TTI improved by 40%.
No more hydration waterfalls.