Skip to content

Show warning when withEnabledBlockingInitialNavigation Is used with provideClientHydration #59624

Closed

Description

@alan-agius4

Which @angular/* package(s) are relevant/related to the feature request?

router, platform-browser

Description

The withEnabledBlockingInitialNavigation option was designed specifically for use cases involving deferred hydration to prevent UI flickers during initial navigation. However, when used with provideClientHydration, which supports standard hydration, the issue of flickering does not arise. To avoid confusion and misuse, a warning should be displayed in the console when these two configurations are used together, as they are not intended to work in tandem.

Proposed solution

Issue warning when these 2 methods are used togather.

Activity

  1. added
    area: core
    on Jan 22, 2025
  2. added this to the needsTriage milestone on Jan 22, 2025
  3. added
    open for contributions
    on Jan 22, 2025
  4. peckomingo commented on Jan 24, 2025

    @peckomingo

    The flickering issue also arises when lazy-loaded routes are used, and some components outside of this route rely on its data.

    For example:
    I use SSR, so hydration kicks in after load. I have a header and a footer outside of <router-outlet> that should change their layout according to the loaded component in the outlet. I pass some data in the route data: { layout: 'compact' } , which is only available once the route is active and the component is loaded. Additionally, router.url from the Router service gives / on the very first page load, and only after the component is in place (around 0.3s) does it have the correct value. So there is a short flicker of header and footer.

    • It only works with imported components in routes, so no lazy loading.
    • It also works with withEnabledBlockingInitialNavigation turned on. I tried it also in combination with provideClientHydration and had no issues so far.

    So, I am unsure what is best here, as the combination of withEnabledBlockingInitialNavigation and provideClientHydration works for me and seems a viable solution so far. Maybe it is not so strict?

  5. SkyZeroZx commented on Aug 2, 2025

    @SkyZeroZx
    Contributor

    I can take this, I already have an advanced solution locally
    PR : #62963

  6. angular-automatic-lock-bot commented on Nov 8, 2025

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  7. locked and limited conversation to collaborators on Nov 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: corecore: hydrationopen for contributions

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions