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 }}
Repository navigation
bug: canActivate does not cancel navigation when using browser back button #43181
Which @angular/* package(s) are the source of the bug?
router
Is this a regression?
No
Description
When using the browser back button to go back to a page with a canActivate guard, navigation is not correctly prevented if the guard returns false and the back button is pressed multiple times.
Steps to reproduce:
Clone attached reproduction, run npm install, and then run npm run start.
In the browser, you should start on /page1.
Click "Go to Page 2". Observe you are on /page2.
Click "Go to Page 3". Observe you are on /page3.
Click "Disable going back to page 2". This will set a flag that causes the canActivate guard on /page2 to return false.
Click the browser back button. Observe that the canActivate guard returns false and navigation is correctly cancelled. You should remain on /page3.
Click the browser back button again. Observe that the canActivate guard is not called and navigation is not cancelled. You should now be on /page1.
Please provide a link to a minimal reproduction of the bug
I would expect that pressing the browser back button would attempt to navigate back to `/page2`, causing the `canActivate` guard to return `false` again.
Please provide the environment you discovered this bug in
Activity
atscott commentedon Aug 17, 2021
Duplicate of #13586
angular-automatic-lock-bot commentedon Sep 17, 2021
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.