Skip to content

Commit

Permalink
Track subtreeFlags et al with bubbleProperties
Browse files Browse the repository at this point in the history
Original PR: facebook#19836
  • Loading branch information
acdlite committed Nov 17, 2020
1 parent 1457a58 commit 665d125
Show file tree
Hide file tree
Showing 4 changed files with 229 additions and 89 deletions.
5 changes: 4 additions & 1 deletion packages/react-reconciler/src/ReactFiber.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
enableFundamentalAPI,
enableScopeAPI,
} from 'shared/ReactFeatureFlags';
import {NoFlags, Placement} from './ReactFiberFlags';
import {NoFlags, Placement, StaticMask} from './ReactFiberFlags';
import {ConcurrentRoot, BlockingRoot} from './ReactRootTags';
import {
IndeterminateComponent,
Expand Down Expand Up @@ -299,6 +299,9 @@ export function createWorkInProgress(current: Fiber, pendingProps: any): Fiber {
}
}

// Reset all effects except static ones.
// Static effects are not specific to a render.
workInProgress.flags = current.flags & StaticMask;
workInProgress.childLanes = current.childLanes;
workInProgress.lanes = current.lanes;

Expand Down
7 changes: 7 additions & 0 deletions packages/react-reconciler/src/ReactFiberBeginWork.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import {
Deletion,
ChildDeletion,
ForceUpdateForLegacySuspense,
StaticMask,
} from './ReactFiberFlags';
import ReactSharedInternals from 'shared/ReactSharedInternals';
import {
Expand Down Expand Up @@ -2092,6 +2093,12 @@ function updateSuspenseFallbackChildren(
currentPrimaryChildFragment,
primaryChildProps,
);

// Since we're reusing a current tree, we need to reuse the flags, too.
// (We don't do this in legacy mode, because in legacy mode we don't re-use
// the current tree; see previous branch.)
primaryChildFragment.subtreeFlags =
currentPrimaryChildFragment.subtreeFlags & StaticMask;
}
let fallbackChildFragment;
if (currentFallbackChildFragment !== null) {
Expand Down
Loading

0 comments on commit 665d125

Please sign in to comment.