Skip to content

Commit c383491

Browse files
jasonadenalxhub
authored andcommittedMay 13, 2019
fix(router): IE 11 bug can break URL unification when comparing objects (#30393)
This PR fixes an issue where IE 11 can return `undefined` in with an `Object.keys` call. Solution is to add a runtime check on the value. Based on the types being passed, this shouldn't be necessary, but is needed only for IE 11. Unit test doesn't work for this PR because it can't be replicated easily. PR Close #30393
1 parent a481772 commit c383491

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ export function shallowEqualArrays(a: any[], b: any[]): boolean {
2323
export function shallowEqual(a: {[x: string]: any}, b: {[x: string]: any}): boolean {
2424
const k1 = Object.keys(a);
2525
const k2 = Object.keys(b);
26-
if (k1.length != k2.length) {
26+
// IE 11 sometimes returns an `undefined` value here. This guard is for IE 11 only.
27+
if (!(k1 || k2) || k1.length != k2.length) {
2728
return false;
2829
}
2930
let key: string;

0 commit comments

Comments
 (0)
Please sign in to comment.