You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
Then if I navigate from sub-a route to b route then the canDeactivate guard will be called with the instance of the AComponent, while it used to be called with the instance of SubAComponent.
If I navigate from sub-a to a, then the guard is called with the proper instance of SubAComponent.
Expected behavior
From my understanding, the guard should only be called with SubAComponent.
We just discovered this bug in our application. Seems like it was working properly in v9.1.1 and not in v9.1.2. We're reverting to v9.1.1 for now and will keep an eye on this.
Thanks for the report. This was caused by merging angular/angular#36302. The failure was detected and the commit was reverted for the 9.1.3 release, which will be cut today.
FYI - please direct your future bug reports to the main angular/angular repo.
@dcatoday - the commit that was reverted was attempting to fix a bug with the incorrect component being passed to canDeactivate but caused a regression in other configs. angular/angular#36302
We reverted the commit to return behavior to what it was before, but that means canDeactivate will still pass the wrong component in the situation that is described in that PR. Without seeing your config, it’s hard to tell what the cause is. Please file an issue with a minimal reproduction on the main Angular repo if you believe there is a bug that isn’t addressed in the existing issue report.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
###Environment:
Overview of the Issue
Consider the following routing tree:
which has canDeactivate guard
The guard is attached to SubAComponent
Then if I navigate from
sub-a
route tob
route then the canDeactivate guard will be called with the instance of theAComponent
, while it used to be called with the instance ofSubAComponent
.If I navigate from
sub-a
toa
, then the guard is called with the proper instance ofSubAComponent
.Expected behavior
From my understanding, the guard should only be called with
SubAComponent
.is it a regression?
Possibly
Reproduce the Error
The following is router v9.1.2 example which shows broken behavior:
https://stackblitz.com/edit/angular-candeactivate-issue-ng9
And the example with the router v9.1.0 which shows I would assume proper behavior
https://stackblitz.com/edit/angular-candeactivate-issue-ng9-router910
In both cases:
Possibly related to
angular/angular@8e7f903
angular/angular#34614
angular/angular#36302
The text was updated successfully, but these errors were encountered: