Skip to content

Commit

Permalink
Bubble passive static subtreeTag even after bailout
Browse files Browse the repository at this point in the history
This prevents subsequent unmounts from skipping over any pending passive effect destroy functions
  • Loading branch information
Brian Vaughn committed Sep 2, 2020
1 parent dc28f00 commit b24aae9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/react-reconciler/src/ReactFiberWorkLoop.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -1904,6 +1904,14 @@ function resetChildLanes(completedWork: Fiber) {
mergeLanes(child.lanes, child.childLanes),
);

// Preserve passive static flag even in the case of a bailout;
// otherwise a subsequent unmount may bailout before calling destroy functions.
subtreeTag |= child.subtreeTag & PassiveStaticSubtreeTag;
const effectTag = child.effectTag;
if ((effectTag & PassiveStatic) !== NoEffect) {
subtreeTag |= PassiveStaticSubtreeTag;
}

treeBaseDuration += child.treeBaseDuration;
child = child.sibling;
}
Expand All @@ -1928,9 +1936,19 @@ function resetChildLanes(completedWork: Fiber) {
mergeLanes(child.lanes, child.childLanes),
);

// Preserve passive static flag even in the case of a bailout;
// otherwise a subsequent unmount may bailout before calling destroy functions.
subtreeTag |= child.subtreeTag & PassiveStaticSubtreeTag;
const effectTag = child.effectTag;
if ((effectTag & PassiveStatic) !== NoEffect) {
subtreeTag |= PassiveStaticSubtreeTag;
}

child = child.sibling;
}
}

completedWork.subtreeTag |= subtreeTag;
}

completedWork.childLanes = newChildLanes;
Expand Down

0 comments on commit b24aae9

Please sign in to comment.