FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(router): check abort signal state on subscribe by arturovt · Pull Request #71176 · angular/angular · GitHub

fix(router): check abort signal state on subscribe - #71176

Draft
arturovt wants to merge 1 commit into
angular:mainfrom
arturovt:fix/router-abort-signal-subscribe-time
Draft

arturovt wants to merge 1 commit into
angular:mainfrom
arturovt:fix/router-abort-signal-subscribe-time

Conversation

arturovt commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Prior to this commit, abortSignalToObservable checked signal.aborted when the observable was created, not when it was subscribed. canMatch and canLoad guards create their observables first and subscribe to them later, so a guard that starts a new navigation (e.g. calls router.navigateByUrl() and returns false) could abort the signal in between. Earlier guards then added the abort listener to an already aborted signal, never saw the abort and stayed subscribed until they settled on their own (or forever, if they never emit). There's no open issue for this, likely because people don't see router internals and might expect earlier guards to keep running as normal behavior.

With this fix, the aborted state is checked on subscribe, so earlier guards are never subscribed once the navigation has been aborted.

Prior to this commit, `abortSignalToObservable` checked `signal.aborted` when
the observable was created, not when it was subscribed. canMatch and canLoad
guards create their observables first and subscribe to them later, so a guard
that starts a new navigation (e.g. calls `router.navigateByUrl()` and returns
`false`) could abort the signal in between. Earlier guards then added the abort
listener to an already aborted signal, never saw the abort and stayed
subscribed until they settled on their own (or forever, if they never emit).
There's no open issue for this, likely because people don't see router
internals and might expect earlier guards to keep running as normal behavior.

With this fix, the aborted state is checked on subscribe, so earlier guards are
never subscribed once the navigation has been aborted.
ngbot Bot added this to the Backlog milestone Oct 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL