Skip to content

Commit 8e5adfb

Browse files
committed
Remove usage of Array#fill (#20071)
1 parent 89b6109 commit 8e5adfb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/react-reconciler/src/ReactFiberLane.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,13 @@ export function higherLanePriority(
640640
}
641641

642642
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;
644650
}
645651

646652
export function markRootUpdated(

0 commit comments

Comments
 (0)