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.