-
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): handle Object.keys router error in Edge #40488
Conversation
const k1 = a ? Object.keys(a) : undefined; | ||
const k2 = b ? Object.keys(b) : undefined; | ||
if (!k1 || !k2 || k1.length != k2.length) { | ||
return false; |
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.
Could we just bail out early if a or b is undefined
?
const k1 = a ? Object.keys(a) : undefined; | |
const k2 = b ? Object.keys(b) : undefined; | |
if (!k1 || !k2 || k1.length != k2.length) { | |
return false; | |
if (!a || !b) { | |
return false; | |
} | |
const k1 = Object.keys(a); | |
const k2 = Object.keys(b); | |
if (k1.length != k2.length) { | |
return false; |
Or is it still possible for Object.keys(x)
to return undefined
even if x
is not undefined?
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.
I think the old comment is indicating that Object.keys(x)
would sometimes return undefined
even if x
is not.
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.
Since this change simplifies the casting of k1 and k2 and has been tested already I'd prefer to keep it as it. Might be able to simplify this in the future once folks are off older versions of Edge
… Edge For the Google Cloud Console within Google we observed errors in the shallowEqual function for users in IE and Edge. This patch was made within Google and the errors went away. This commit upstreams the change into Angular.
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 +1
caretaker note: After merging this PR, you will have to remove the g3 local patch for this, found here |
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. |
For the Google Cloud Console within Google we observed errors in the
shallowEqual function for users in IE and Edge. I made this patch within
Google and observed that the errors went away so I am upstreaming this
change into Angular.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
An error would be thrown in Edge when navigating using shallowEqual
Issue Number: #40090
What is the new behavior?
No error is thrown
Does this PR introduce a breaking change?
Other information