Skip to content

Commit

Permalink
Don't clear other flags when adding Deletion
Browse files Browse the repository at this point in the history
Same as facebook#20398 but for Deletions. There's no new regression test, but in
the effects refactor, existing tests will fail without this.
  • Loading branch information
acdlite committed Dec 11, 2020
1 parent cdfde3a commit 433ea63
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
9 changes: 7 additions & 2 deletions packages/react-reconciler/src/ReactChildFiber.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ import type {Fiber} from './ReactInternalTypes';
import type {Lanes} from './ReactFiberLane.new';

import getComponentName from 'shared/getComponentName';
import {Deletion, ChildDeletion, Placement} from './ReactFiberFlags';
import {
Deletion,
ChildDeletion,
Placement,
StaticMask,
} from './ReactFiberFlags';
import {
getIteratorFn,
REACT_ELEMENT_TYPE,
Expand Down Expand Up @@ -275,7 +280,7 @@ function ChildReconciler(shouldTrackSideEffects) {
returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
}
childToDelete.nextEffect = null;
childToDelete.flags = Deletion;
childToDelete.flags = (childToDelete.flags & StaticMask) | Deletion;

let deletions = returnFiber.deletions;
if (deletions === null) {
Expand Down
5 changes: 3 additions & 2 deletions packages/react-reconciler/src/ReactFiberBeginWork.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -2007,7 +2007,8 @@ function updateSuspensePrimaryChildren(
if (currentFallbackChildFragment !== null) {
// Delete the fallback child fragment
currentFallbackChildFragment.nextEffect = null;
currentFallbackChildFragment.flags = Deletion;
currentFallbackChildFragment.flags =
(currentFallbackChildFragment.flags & StaticMask) | Deletion;
workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChildFragment;
let deletions = workInProgress.deletions;
if (deletions === null) {
Expand Down Expand Up @@ -2998,7 +2999,7 @@ function remountFiber(
returnFiber.firstEffect = returnFiber.lastEffect = current;
}
current.nextEffect = null;
current.flags = Deletion;
current.flags = (current.flags & StaticMask) | Deletion;

let deletions = returnFiber.deletions;
if (deletions === null) {
Expand Down
10 changes: 8 additions & 2 deletions packages/react-reconciler/src/ReactFiberHydrationContext.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ import {
HostRoot,
SuspenseComponent,
} from './ReactWorkTags';
import {Deletion, ChildDeletion, Placement, Hydrating} from './ReactFiberFlags';
import {
Deletion,
ChildDeletion,
Placement,
Hydrating,
StaticMask,
} from './ReactFiberFlags';
import invariant from 'shared/invariant';

import {
Expand Down Expand Up @@ -124,7 +130,7 @@ function deleteHydratableInstance(
const childToDelete = createFiberFromHostInstanceForDeletion();
childToDelete.stateNode = instance;
childToDelete.return = returnFiber;
childToDelete.flags = Deletion;
childToDelete.flags = (childToDelete.flags & StaticMask) | Deletion;

// This might seem like it belongs on progressedFirstDeletion. However,
// these children are not part of the reconciliation list of children.
Expand Down

0 comments on commit 433ea63

Please sign in to comment.