From 6f62abb58ae46d9c88525635f1790487285666e6 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Wed, 21 Oct 2020 13:17:44 +0100 Subject: [PATCH] Remove usage of Array#fill (#20071) --- packages/react-reconciler/src/ReactFiberLane.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/react-reconciler/src/ReactFiberLane.js b/packages/react-reconciler/src/ReactFiberLane.js index 3dc89c45a9561..027754dd76ee0 100644 --- a/packages/react-reconciler/src/ReactFiberLane.js +++ b/packages/react-reconciler/src/ReactFiberLane.js @@ -640,7 +640,13 @@ export function higherLanePriority( } export function createLaneMap(initial: T): LaneMap { - 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(