FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(router): Fix occasional error when creating url tree in IE 11 and… · angular/angular@f0733d1 · GitHub

Commit f0733d1

Browse files
authored andcommitted
fix(router): Fix occasional error when creating url tree in IE 11 and Edge (#40488)
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. PR Close #40488
1 parent 0e95460 commit f0733d1

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

‎packages/router/src/utils/collection.ts‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@ export function shallowEqualArrays(a: any[], b: any[]): boolean {
2020
}
2121

2222
export function shallowEqual(a: Params, b: Params): boolean {
23-
// Casting Object.keys return values to include `undefined` as there are some cases
24-
// in IE 11 where this can happen. Cannot provide a test because the behavior only
25-
// exists in certain circumstances in IE 11, therefore doing this cast ensures the
26-
// logic is correct for when this edge case is hit.
27-
const k1 = Object.keys(a) as string[] | undefined;
28-
const k2 = Object.keys(b) as string[] | undefined;
23+
// While `undefined` should never be possible, it would sometimes be the case in IE 11
24+
// and pre-chromium Edge. The check below accounts for this edge case.
25+
const k1 = a ? Object.keys(a) : undefined;
26+
const k2 = b ? Object.keys(b) : undefined;
2927
if (!k1 || !k2 || k1.length != k2.length) {
3028
return false;
3129
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL