Skip to content

Commit 2ae3590

Browse files
committed
Add new effect fields to old fork
So that when comparing relative performance, we don't penalize the new fork for using more memory.
1 parent 2fbcc98 commit 2ae3590

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ module.exports = {
122122
// Disabled because it's also used by the Hook type.
123123
// 'lastEffect',
124124
],
125-
new: ['subtreeFlags'],
125+
new: [],
126126
},
127127
],
128128
},

packages/react-reconciler/src/ReactFiber.old.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ function FiberNode(
145145

146146
this.firstEffect = null;
147147
this.lastEffect = null;
148+
this.subtreeFlags = NoFlags;
149+
this.deletions = null;
148150

149151
this.lanes = NoLanes;
150152
this.childLanes = NoLanes;
@@ -284,6 +286,8 @@ export function createWorkInProgress(current: Fiber, pendingProps: any): Fiber {
284286
workInProgress.nextEffect = null;
285287
workInProgress.firstEffect = null;
286288
workInProgress.lastEffect = null;
289+
workInProgress.subtreeFlags = NoFlags;
290+
workInProgress.deletions = null;
287291

288292
if (enableProfilerTimer) {
289293
// We intentionally reset, rather than copy, actualDuration & actualStartTime.
@@ -372,6 +376,7 @@ export function resetWorkInProgress(workInProgress: Fiber, renderLanes: Lanes) {
372376
workInProgress.lanes = renderLanes;
373377

374378
workInProgress.child = null;
379+
workInProgress.subtreeFlags = NoFlags;
375380
workInProgress.memoizedProps = null;
376381
workInProgress.memoizedState = null;
377382
workInProgress.updateQueue = null;
@@ -392,6 +397,8 @@ export function resetWorkInProgress(workInProgress: Fiber, renderLanes: Lanes) {
392397
workInProgress.lanes = current.lanes;
393398

394399
workInProgress.child = current.child;
400+
workInProgress.subtreeFlags = current.subtreeFlags;
401+
workInProgress.deletions = null;
395402
workInProgress.memoizedProps = current.memoizedProps;
396403
workInProgress.memoizedState = current.memoizedState;
397404
workInProgress.updateQueue = current.updateQueue;
@@ -814,6 +821,8 @@ export function assignFiberPropertiesInDEV(
814821
target.nextEffect = source.nextEffect;
815822
target.firstEffect = source.firstEffect;
816823
target.lastEffect = source.lastEffect;
824+
target.subtreeFlags = source.subtreeFlags;
825+
target.deletions = source.deletions;
817826
target.lanes = source.lanes;
818827
target.childLanes = source.childLanes;
819828
target.alternate = source.alternate;

0 commit comments

Comments
 (0)