Repository navigation
Closed
Closed
Copy link
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: routerregressionIndicates than the issue relates to something that worked in a previous version
Milestone
Description
Which @angular/* package(s) are the source of the bug?
router
Is this a regression?
Yes
Description
-
There's bug in Angular@>=14.0.5, where
router.eventsdoesn't emitNavigationEndevent if navigation was triggered while other was in progress, in addition to that it won't even update the url with the new value -
This bug happens when trying to do router navigation while other navigation is in progress
-
Happens only if router config has set
initialNavigation: 'enabledBlocking' -
This bug was introduced in [email protected] which has only this single MR merged
How to reproduce: (pretty easily)
- Try to do
router.navigate()insidengOnInit()hook in root component (AppComponent)
Minimal reproduction:
- In the console you can see events emitted in following order:
- NavigationStart (first app navigation)
- (RoutesRecognized, GuardsCheckStart, GuardsCheckEnd)
- AppComponent#ngOnInit navigation triggered
- NavigationCancel
- NavigationStart
- (RoutesRecognized, GuardsCheckStart, GuardsCheckEnd)
- On the 7th step I would expect NavigationEnd should be emitted, so I would know that router navigation has been finished, otherwise I'm not able to know that
- In the console you can see events emitted in following order:
- NavigationStart (first app navigation)
- (RoutesRecognized, GuardsCheckStart, GuardsCheckEnd)
- AppComponent#ngOnInit navigation triggered
- NavigationCancel
- NavigationStart
- (RoutesRecognized, GuardsCheckStart, GuardsCheckEnd)
- Navigation End & Scroll
- As you see, in this version it correctly emits NavigationEnd event so I know, that navigation has been finished
Please provide a link to a minimal reproduction of the bug
See in description
Please provide the exception or error you saw
No error/exception is being thrown
Please provide the environment you discovered this bug in (run ng version)
Angular CLI: >= 14.0.5
Node: 18.10.0
Package Manager: [email protected]
OS: Windows 11 64bit
All Angular packages version: >= 14.0.5
Anything else?
- If this change was intended, can anyone suggest, how can I in this case know, when the navigation has been finished?
Reacted by JirkaBures, Johnczek, Treen11, Petr Gerych and Brandinga
Metadata
Metadata
Assignees
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: routerregressionIndicates than the issue relates to something that worked in a previous version
Activity
Treen11 commentedon Nov 15, 2022
same here
salopa commentedon Nov 15, 2022
+1
atscott commentedon Nov 15, 2022
Thanks for the reproductions. I'll get this fixed today and it should be included in the releases tomorrow.
fix(router): Ensure renavigating in component init works with enabled…
fix(router): Ensure renavigating in component init works with enabled…
angular-automatic-lock-bot commentedon Dec 18, 2022
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.
fix(router): Ensure renavigating in component init works with enabled…