Skip to content

Commit da55fb3

Browse files
author
Brian Vaughn
committed
Bubble passive static subtreeTag even after bailout
This prevents subsequent unmounts from skipping over any pending passive effect destroy functions
1 parent e28575b commit da55fb3

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1904,6 +1904,14 @@ function resetChildLanes(completedWork: Fiber) {
19041904
mergeLanes(child.lanes, child.childLanes),
19051905
);
19061906

1907+
// Preserve passive static flag even in the case of a bailout;
1908+
// otherwise a subsequent unmount may bailout before calling destroy functions.
1909+
subtreeTag |= child.subtreeTag & PassiveStaticSubtreeTag;
1910+
const effectTag = child.effectTag;
1911+
if ((effectTag & PassiveStatic) !== NoEffect) {
1912+
subtreeTag |= PassiveStaticSubtreeTag;
1913+
}
1914+
19071915
treeBaseDuration += child.treeBaseDuration;
19081916
child = child.sibling;
19091917
}
@@ -1928,9 +1936,19 @@ function resetChildLanes(completedWork: Fiber) {
19281936
mergeLanes(child.lanes, child.childLanes),
19291937
);
19301938

1939+
// Preserve passive static flag even in the case of a bailout;
1940+
// otherwise a subsequent unmount may bailout before calling destroy functions.
1941+
subtreeTag |= child.subtreeTag & PassiveStaticSubtreeTag;
1942+
const effectTag = child.effectTag;
1943+
if ((effectTag & PassiveStatic) !== NoEffect) {
1944+
subtreeTag |= PassiveStaticSubtreeTag;
1945+
}
1946+
19311947
child = child.sibling;
19321948
}
19331949
}
1950+
1951+
completedWork.subtreeTag |= subtreeTag;
19341952
}
19351953

19361954
completedWork.childLanes = newChildLanes;

0 commit comments

Comments
 (0)