Skip to content

Commit

Permalink
Remove usage of Array#fill
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Oct 21, 2020
1 parent 40cfe1f commit 05abbb3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/react-reconciler/src/ReactFiberLane.js
Expand Up @@ -640,7 +640,13 @@ export function higherLanePriority(
}

export function createLaneMap<T>(initial: T): LaneMap<T> {
return new Array(TotalLanes).fill(initial);
// Intentionally pushing one by one.
// https://v8.dev/blog/elements-kinds#avoid-creating-holes
const laneMap = [];
for (let i = 0; i < TotalLanes; i++) {
laneMap.push(initial);
}
return laneMap;
}

export function markRootUpdated(
Expand Down

1 comment on commit 05abbb3

@shavidze
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how did it solve the problem? HOLEY array was failing for IE11?

Please sign in to comment.