Re-navigating to a the same url during an active navigation causes cancellation without a new navigation starting
See original GitHub issue🐞 bug report
Affected Package
@angular/router
Is this a regression?
No
Description
While the router is in the route activation phase if it receives another navigation request that results in the same url the active navigation will be canceled, but the new navigation won’t start. This only occurs when onSameUrlNavigation=false (the default). I would expect that a NavigationEnd event would be emitted for either the first or replacement navigation, but currently one is never emitted.
🔬 Minimal Reproduction
https://angular-fz4k5d.stackblitz.io
Click the “Test” link to navigate to navigate to /test?query=someText
NavigationStart {id: 1, url: "/", navigationTrigger: "imperative", restoredState: null}
RoutesRecognized {id: 1, url: "/", urlAfterRedirects: "/404", state: RouterStateSnapshot}
GuardsCheckStart {id: 1, url: "/", urlAfterRedirects: "/404", state: RouterStateSnapshot}
ChildActivationStart {snapshot: ActivatedRouteSnapshot}
ActivationStart {snapshot: ActivatedRouteSnapshot}
GuardsCheckEnd {id: 1, url: "/", urlAfterRedirects: "/404", state: RouterStateSnapshot, shouldActivate: true}
ResolveStart {id: 1, url: "/", urlAfterRedirects: "/404", state: RouterStateSnapshot}
ResolveEnd {id: 1, url: "/", urlAfterRedirects: "/404", state: RouterStateSnapshot}
ActivationEnd {snapshot: ActivatedRouteSnapshot}
ChildActivationEnd {snapshot: ActivatedRouteSnapshot}
NavigationEnd {id: 1, url: "/", urlAfterRedirects: "/404"}
Scroll {routerEvent: NavigationEnd, position: null, anchor: null
### Click test link
NavigationStart {id: 2, url: "/test?query=someText", navigationTrigger: "imperative", restoredState: null}
RoutesRecognized {id: 2, url: "/test?query=someText", urlAfterRedirects: "/test?query=someText", state: RouterStateSnapshot}
GuardsCheckStart {id: 2, url: "/test?query=someText", urlAfterRedirects: "/test?query=someText", state: RouterStateSnapshot}
ChildActivationStart {snapshot: ActivatedRouteSnapshot}
ActivationStart {snapshot: ActivatedRouteSnapshot}
GuardsCheckEnd {id: 2, url: "/test?query=someText", urlAfterRedirects: "/test?query=someText", state: RouterStateSnapshot, shouldActivate: true}
ResolveStart {id: 2, url: "/test?query=someText", urlAfterRedirects: "/test?query=someText", state: RouterStateSnapshot}
ResolveEnd {id: 2, url: "/test?query=someText", urlAfterRedirects: "/test?query=someText", state: RouterStateSnapshot}
### navigate from component constructor loaded through route activation triggers previous navigation to cancel
### This navigation is also to /test?query=someText
NavigationCancel {id: 2, url: "/test?query=someText", reason: "Navigation ID 2 is not equal to the current navigation id 3"}
### I think these are left over from id=2
ActivationEnd {snapshot: ActivatedRouteSnapshot}
ChildActivationEnd {snapshot: ActivatedRouteSnapshot}
### No NavigationEnd event fires for navigating to /test?query=someText (for id=2 nor id=3)
### No Navigation events fire for id=3
🌍 Your Environment
Angular Version:
8.2.14
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:11 (2 by maintainers)
Top Results From Across the Web
Navigation is canceled when you browse to Web pages that ...
Describes a problem in which Internet Explorer may stop responding when you browse to Web pages that in different Internet Explorer security zones....
Read more >Angular: Refetch data on same URL navigation - Medium
The first approach is to tell the Angular router to emit the route events on refresh and then handle them accordingly in our...
Read more >Navigation Menu - Salesforce Help
The Navigation Menu component extends your site's navigation beyond navigational topics. Navigation menu items can include Salesforce objects, topics, pag.
Read more >Connect to your world with Connected Navigation options ...
Connected Built-In Navigation: Navigation services require SYNC® 4 and FordPass Connect (optional on select vehicles), complimentary Connected Service and the ...
Read more >Buttons - Lightning Design System
Use a link when you're navigating to another place, such as: a "view all" page, ... If pressing a Button results in a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

This is still happening on Angular@10, when re-navigation is triggered from inside of a Guard.