From 197584d1af1daeebe57a6b947851197553884e82 Mon Sep 17 00:00:00 2001 From: Jason Aden Date: Fri, 10 May 2019 08:49:17 -0700 Subject: [PATCH] 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 --- packages/router/src/utils/collection.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/router/src/utils/collection.ts b/packages/router/src/utils/collection.ts index 6834cec4cf..149182dde2 100644 --- a/packages/router/src/utils/collection.ts +++ b/packages/router/src/utils/collection.ts @@ -23,7 +23,8 @@ export function shallowEqualArrays(a: any[], b: any[]): boolean { export function shallowEqual(a: {[x: string]: any}, b: {[x: string]: any}): boolean { const k1 = Object.keys(a); const k2 = Object.keys(b); - if (k1.length != k2.length) { + // IE 11 sometimes returns an `undefined` value here. This guard is for IE 11 only. + if (!(k1 || k2) || k1.length != k2.length) { return false; } let key: string;