Skip to content

Commit

Permalink
fix(router): Remove usage of Object.entries to avoid the need for a…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
atscott committed Jan 7, 2021
1 parent 48526cc commit 6429be1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/router/src/apply_redirects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down

0 comments on commit 6429be1

Please sign in to comment.