-
Notifications
You must be signed in to change notification settings - Fork 24.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(router): fix navigation ignoring logic to compare to the browser url #37716
Conversation
a72e895
to
2368c37
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix @atscott, I've left a few minor comments. Please have a look when you get a chance.
2368c37
to
e0dfb84
Compare
This PR changes the logic for determining when to skip route processing from using the URL of the last attempted navigation to the actual resulting URL after that transition. Because guards may prevent navigation and reset the browser URL, the raw URL of the previous transition may not match the actual URL of the browser at the end of the navigation process. For that reason, we need to use `urlAfterRedirects` instead. Other notes: These checks in scheduleNavigation were added in angular@eb2ceff The test still passes and, more surprisingly, passes if the checks are removed completely. There have likely been changes to the navigation handling that handle the test in a different way. That said, it still appears to be important to keep the checks there in some capacity because it does affect how many navigation events occur. This addresses an issue that came up in angular#16710: angular#16710 (comment) This also partially addresses angular#13586 in fixing history for imperative navigations that are cancelled by guards.
e0dfb84
to
2d4d32d
Compare
@AndrewKushnir - Thanks for the review! I've addressed your comments - PTAL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 Thanks @atscott.
[global presubmit(https://test.corp.google.com/ui#id=OCL:318866503:BASE:319047837:1593570501085:2a82c23f) showing no failures. caretaker note: please merge and sync this one separately - it's a resubmit (with a fix) of a previous commit that caused a failure in g3 and had to be rolled back. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
…url (angular#37716) This PR changes the logic for determining when to skip route processing from using the URL of the last attempted navigation to the actual resulting URL after that transition. Because guards may prevent navigation and reset the browser URL, the raw URL of the previous transition may not match the actual URL of the browser at the end of the navigation process. For that reason, we need to use `urlAfterRedirects` instead. Other notes: These checks in scheduleNavigation were added in angular@eb2ceff The test still passes and, more surprisingly, passes if the checks are removed completely. There have likely been changes to the navigation handling that handle the test in a different way. That said, it still appears to be important to keep the checks there in some capacity because it does affect how many navigation events occur. This addresses an issue that came up in angular#16710: angular#16710 (comment) This also partially addresses angular#13586 in fixing history for imperative navigations that are cancelled by guards. PR Close angular#37716
This PR changes the logic for determining when to skip route processing from
using the URL of the last attempted navigation to the actual resulting URL after
that transition.
Because guards may prevent navigation and reset the browser URL, the raw
URL of the previous transition may not match the actual URL of the
browser at the end of the navigation process. For that reason, we need to use
urlAfterRedirects
if the previous navigation failed.Note that this is a resubmit of d3a8175 which caused a failure in Google. I've verified that this change does not result in the same failure but this PR should still be merged and synced separately.