Skip to content

Commit 3ebf051

Browse files
authored
Add new effect fields to old fork, and vice versa (#20246)
* Add new effect fields to old fork So that when comparing relative performance, we don't penalize the new fork for using more memory. * Add firstEffect, et al fields to new fork We need to bisect the changes to the recent commit phase refactor. To do this, we'll need to add back the effect list temporarily. This only adds them to the Fiber type so that the memory is the same as the old fork.
1 parent 2fbcc98 commit 3ebf051

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

.eslintrc.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,8 @@ module.exports = {
116116
'react-internal/no-cross-fork-types': [
117117
ERROR,
118118
{
119-
old: [
120-
'firstEffect',
121-
'nextEffect',
122-
// Disabled because it's also used by the Hook type.
123-
// 'lastEffect',
124-
],
125-
new: ['subtreeFlags'],
119+
old: [],
120+
new: [],
126121
},
127122
],
128123
},
@@ -190,7 +185,7 @@ module.exports = {
190185
{
191186
files: [
192187
'packages/react-native-renderer/**/*.js',
193-
'packages/react-transport-native-relay/**/*.js'
188+
'packages/react-transport-native-relay/**/*.js',
194189
],
195190
globals: {
196191
nativeFabricUIManager: true,

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ function FiberNode(
141141

142142
// Effects
143143
this.flags = NoFlags;
144+
this.nextEffect = null;
145+
146+
this.firstEffect = null;
147+
this.lastEffect = null;
144148
this.subtreeFlags = NoFlags;
145149
this.deletions = null;
146150

@@ -805,6 +809,9 @@ export function assignFiberPropertiesInDEV(
805809
target.dependencies = source.dependencies;
806810
target.mode = source.mode;
807811
target.flags = source.flags;
812+
target.nextEffect = source.nextEffect;
813+
target.firstEffect = source.firstEffect;
814+
target.lastEffect = source.lastEffect;
808815
target.subtreeFlags = source.subtreeFlags;
809816
target.deletions = source.deletions;
810817
target.lanes = source.lanes;

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)