Title: Router events doesn't emit NavigationEnd event if previous navigation was cancelled · Issue #48052 · angular/angular · GitHub
Open Graph Title: Router events doesn't emit NavigationEnd event if previous navigation was cancelled · Issue #48052 · angular/angular
X Title: Router events doesn't emit NavigationEnd event if previous navigation was cancelled · Issue #48052 · angular/angular
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.events doesn't emit NavigationEnd event if navigation was triggered while other was in prog...
Open Graph 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.events doesn't emit NavigationEnd event if navigati...
X 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.events doesn't emit NavigationEnd event ...
Opengraph URL: https://github.com/angular/angular/issues/48052
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Router events doesn't emit NavigationEnd event if previous navigation was cancelled","articleBody":"### Which @angular/* package(s) are the source of the bug?\r\n\r\nrouter\r\n\r\n### Is this a regression?\r\n\r\nYes\r\n\r\n### Description\r\n\r\n- There's bug in Angular@>=14.0.5, where `router.events` doesn't emit `NavigationEnd` event if navigation was triggered while other was in progress, in addition to that it won't even update the url with the new value\r\n\r\n- This bug happens when trying to do router navigation while other navigation is in progress\r\n- Happens only if router config has set `initialNavigation: 'enabledBlocking'`\r\n- This bug was introduced in [Angular@14.0.5](https://github.com/angular/angular/blob/main/CHANGELOG.md#1405-2022-07-06) which has only this [single MR](https://github.com/angular/angular/pull/46634) merged\r\n\r\n### How to reproduce: (pretty easily)\r\n- Try to do `router.navigate()` inside `ngOnInit()` hook in root component (AppComponent)\r\n\r\n### Minimal reproduction:\r\n\r\n[14.0.5 - bug introduced](https://stackblitz.com/edit/angular-ivy-vvsqhn)\r\n - In the console you can see events emitted in following order:\r\n 1. NavigationStart (first app navigation)\r\n 2. (RoutesRecognized, GuardsCheckStart, GuardsCheckEnd)\r\n 3. AppComponent#ngOnInit navigation triggered\r\n 4. NavigationCancel\r\n 5. NavigationStart\r\n 6. (RoutesRecognized, GuardsCheckStart, GuardsCheckEnd)\r\n - 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\r\n \r\n [14.0.4 - working correctly](https://stackblitz.com/edit/angular-ivy-ubquwv)\r\n - In the console you can see events emitted in following order:\r\n 1. NavigationStart (first app navigation)\r\n 2. (RoutesRecognized, GuardsCheckStart, GuardsCheckEnd)\r\n 3. AppComponent#ngOnInit navigation triggered\r\n 4. NavigationCancel\r\n 5. NavigationStart\r\n 6. (RoutesRecognized, GuardsCheckStart, GuardsCheckEnd)\r\n 7. Navigation End & Scroll\r\n - As you see, in this version it correctly emits NavigationEnd event so I know, that navigation has been finished\r\n\r\n\r\n\r\n### Please provide a link to a minimal reproduction of the bug\r\n\r\nSee in description\r\n\r\n### Please provide the exception or error you saw\r\n\r\nNo error/exception is being thrown\r\n\r\n### Please provide the environment you discovered this bug in (run `ng version`)\r\n\r\n```true\r\nAngular CLI: >= 14.0.5\r\nNode: 18.10.0\r\nPackage Manager: npm@8.19.2\r\nOS: Windows 11 64bit\r\nAll Angular packages version: >= 14.0.5\r\n```\r\n\r\n\r\n### Anything else?\r\n\r\n- If this change was intended, can anyone suggest, how can I in this case know, when the navigation has been finished?","author":{"url":"https://github.com/Roman-Simik","@type":"Person","name":"Roman-Simik"},"datePublished":"2022-11-14T18:53:52Z","url":"https://github.com/angular/angular/issues/48052"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a9ec1f22-f42d-10f7-b4ff-add157cd31a5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E0F4:1F44:B932F2:F2AD87:6B01188E |
| html-safe-nonce | ce64a214395300e8e2ef954ccd3d47d78c07b6919e88a224c2469c161b4f4d89 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMEY0OjFGNDQ6QjkzMkYyOkYyQUQ4Nzo2QjAxMTg4RSIsInZpc2l0b3JfaWQiOiI0MDU3MTI2MTAwNzMwNDUyMTEwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 788965f6922db9c8d3d5a37a68683bcc1942faaafca55e93efb656606f97b8d9 |
| hovercard-subject-tag | issue:1448571938 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/48052/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a463549b13bb9a5759f1618d8e8efe881f5528038f4f3bd78c311a80ca65059a/angular/angular/issues/48052 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a463549b13bb9a5759f1618d8e8efe881f5528038f4f3bd78c311a80ca65059a/angular/angular/issues/48052 |
| og:image:alt | 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.events doesn't emit NavigationEnd event if navigati... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Roman-Simik |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width