Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new effect fields to old fork, and vice versa #20246

Merged
merged 2 commits into from
Nov 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,8 @@ module.exports = {
'react-internal/no-cross-fork-types': [
ERROR,
{
old: [
'firstEffect',
'nextEffect',
// Disabled because it's also used by the Hook type.
// 'lastEffect',
],
new: ['subtreeFlags'],
old: [],
new: [],
},
],
},
Expand Down Expand Up @@ -190,7 +185,7 @@ module.exports = {
{
files: [
'packages/react-native-renderer/**/*.js',
'packages/react-transport-native-relay/**/*.js'
'packages/react-transport-native-relay/**/*.js',
],
globals: {
nativeFabricUIManager: true,
Expand Down
7 changes: 7 additions & 0 deletions packages/react-reconciler/src/ReactFiber.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ function FiberNode(

// Effects
this.flags = NoFlags;
this.nextEffect = null;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always wondered about this newline 😆

this.firstEffect = null;
this.lastEffect = null;
this.subtreeFlags = NoFlags;
this.deletions = null;

Expand Down Expand Up @@ -805,6 +809,9 @@ export function assignFiberPropertiesInDEV(
target.dependencies = source.dependencies;
target.mode = source.mode;
target.flags = source.flags;
target.nextEffect = source.nextEffect;
target.firstEffect = source.firstEffect;
target.lastEffect = source.lastEffect;
target.subtreeFlags = source.subtreeFlags;
target.deletions = source.deletions;
target.lanes = source.lanes;
Expand Down
9 changes: 9 additions & 0 deletions packages/react-reconciler/src/ReactFiber.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ function FiberNode(

this.firstEffect = null;
this.lastEffect = null;
this.subtreeFlags = NoFlags;
this.deletions = null;

this.lanes = NoLanes;
this.childLanes = NoLanes;
Expand Down Expand Up @@ -284,6 +286,8 @@ export function createWorkInProgress(current: Fiber, pendingProps: any): Fiber {
workInProgress.nextEffect = null;
workInProgress.firstEffect = null;
workInProgress.lastEffect = null;
workInProgress.subtreeFlags = NoFlags;
workInProgress.deletions = null;

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

workInProgress.child = null;
workInProgress.subtreeFlags = NoFlags;
workInProgress.memoizedProps = null;
workInProgress.memoizedState = null;
workInProgress.updateQueue = null;
Expand All @@ -392,6 +397,8 @@ export function resetWorkInProgress(workInProgress: Fiber, renderLanes: Lanes) {
workInProgress.lanes = current.lanes;

workInProgress.child = current.child;
workInProgress.subtreeFlags = current.subtreeFlags;
workInProgress.deletions = null;
workInProgress.memoizedProps = current.memoizedProps;
workInProgress.memoizedState = current.memoizedState;
workInProgress.updateQueue = current.updateQueue;
Expand Down Expand Up @@ -814,6 +821,8 @@ export function assignFiberPropertiesInDEV(
target.nextEffect = source.nextEffect;
target.firstEffect = source.firstEffect;
target.lastEffect = source.lastEffect;
target.subtreeFlags = source.subtreeFlags;
target.deletions = source.deletions;
target.lanes = source.lanes;
target.childLanes = source.childLanes;
target.alternate = source.alternate;
Expand Down