From 2028a435809bb10afc3596cc90f4ed9358b46a83 Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Thu, 7 Jan 2021 09:58:04 -0800 Subject: [PATCH] fix(router): Remove usage of `Object.entries` to avoid the need for a polyfill (#40340) `Object.entries` is not supported in IE11 without a polyfill. The quickest, most straightfoward fix for this is to simply use `Object.keys` instead. We may want to consider including the polyfill in the CLI in the future or just wait until IE11 support is dropped before using `Object.entries`. PR Close #40340 --- packages/router/src/apply_redirects.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/router/src/apply_redirects.ts b/packages/router/src/apply_redirects.ts index 22228b1290..8b6a2ec2f0 100644 --- a/packages/router/src/apply_redirects.ts +++ b/packages/router/src/apply_redirects.ts @@ -502,7 +502,8 @@ function mergeTrivialChildren(s: UrlSegmentGroup): UrlSegmentGroup { */ function squashSegmentGroup(segmentGroup: UrlSegmentGroup): UrlSegmentGroup { const newChildren = {} as any; - for (const [childOutlet, child] of Object.entries(segmentGroup.children)) { + for (const childOutlet of Object.keys(segmentGroup.children)) { + const child = segmentGroup.children[childOutlet]; const childCandidate = squashSegmentGroup(child); // don't add empty children if (childCandidate.segments.length > 0 || childCandidate.hasChildren()) {