You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Show warning when withEnabledBlockingInitialNavigation Is used with provideClientHydration #59624
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.
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?
Activity
peckomingo commentedon Jan 24, 2025
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 routedata: { layout: 'compact' }, which is only available once the route is active and the component is loaded. Additionally,router.urlfrom theRouterservice 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.withEnabledBlockingInitialNavigationturned on. I tried it also in combination withprovideClientHydrationand had no issues so far.So, I am unsure what is best here, as the combination of
withEnabledBlockingInitialNavigationandprovideClientHydrationworks for me and seems a viable solution so far. Maybe it is not so strict?SkyZeroZx commentedon Aug 2, 2025
I can take this, I already have an advanced solution locally
PR : #62963
angular-automatic-lock-bot commentedon Nov 8, 2025
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.