Remove usage of Array#fill (#20071)
Dan Abramov committed
Oct 21, 2020 at 13:17 UTC
6f62abb58ae46d9c88525635f1790487285666e6
1 file changed
+7
-1
packages/react-reconciler/src/ReactFiberLane.js
+7
-1
@@ -640,7 +640,13 @@ export function higherLanePriority(
640
}
641
642
export function createLaneMap<T>(initial: T): LaneMap<T> {
643
- return new Array(TotalLanes).fill(initial);
643
+ // Intentionally pushing one by one.
644
+ // https://v8.dev/blog/elements-kinds#avoid-creating-holes
645
+ const laneMap = [];
646
+ for (let i = 0; i < TotalLanes; i++) {
647
+ laneMap.push(initial);
648
+ }
649
+ return laneMap;
650
}
651
652
export function markRootUpdated(