MCPcopy Create free account
hub / github.com/angular/angular / withIncrementalHydration

Function withIncrementalHydration

packages/core/src/hydration/api.ts:343–385  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

341 * Intent to remove in v24.
342 */
343export function withIncrementalHydration(): Provider[] {
344 const providers: Provider[] = [
345 withEventReplay(),
346 {
347 provide: IS_INCREMENTAL_HYDRATION_ENABLED,
348 useValue: true,
349 },
350 {
351 provide: DEHYDRATED_BLOCK_REGISTRY,
352 useFactory: createDehydratedBlockRegistry,
353 },
354 ];
355
356 if (typeof ngServerMode === 'undefined' || !ngServerMode) {
357 providers.push(
358 {
359 provide: INCREMENTAL_HYDRATION_BOOTSTRAP,
360 useFactory: () => ({
361 requested: false,
362 activated: false,
363 injector: inject(Injector),
364 document: inject(DOCUMENT),
365 }),
366 },
367 {
368 provide: APP_BOOTSTRAP_LISTENER,
369 useFactory: () => {
370 const state = inject(INCREMENTAL_HYDRATION_BOOTSTRAP);
371
372 return () => {
373 if (!state.requested) {
374 state.requested = true;
375 runIncrementalHydrationBootstrap(state);
376 }
377 };
378 },
379 multi: true,
380 },
381 );
382 }
383
384 return providers;
385}
386
387/**
388 *

Callers

nothing calls this directly

Calls 4

withEventReplayFunction · 0.90
injectFunction · 0.90
pushMethod · 0.45

Tested by

no test coverage detected