W3cubDocs

/Angular

withNoDomReuse

function developer preview

Disables DOM nodes reuse during hydration. Effectively makes Angular re-render an application from scratch on the client.

See more...

withNoDomReuse(): HydrationFeature<HydrationFeatureKind.NoDomReuseFeature>

Parameters

There are no parameters.

Returns

HydrationFeature<HydrationFeatureKind.NoDomReuseFeature>

See also

Description

When this option is enabled, make sure that the initial navigation option is configured for the Router as enabledBlocking by using the withEnabledBlockingInitialNavigation in the provideRouter call:

bootstrapApplication(RootComponent, {
  providers: [
    provideRouter(
      // ... other features ...
      withEnabledBlockingInitialNavigation()
    ),
    provideClientHydration(withNoDomReuse())
  ]
});

This would ensure that the application is rerendered after all async operations in the Router (such as lazy-loading of components, waiting for async guards and resolvers) are completed to avoid clearing the DOM on the client too soon, thus causing content flicker.

© 2010–2023 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/api/platform-browser/withNoDomReuse