Check for passive effects on the root fiber (#19488)

The root fiber doesn't have a parent from which we can read the
`subtreeTag`, so we need to check its `effectTag` directly.

The root fiber previously did not have any pending passive effects,
but it does now that deleted fibers are cleaned up in the passive phase.

This allows us to remove a `schedulePassiveEffectCallback` call from the
synchronous unmount path.

Co-authored-by: Brian Vaughn <bvaughn@fb.com>
This commit is contained in:
Andrew ClarkandBrian Vaughn authored and GitHub committed 2020-07-30 09:17:22 -04:00
1 parent e1f96b82b4
commit 6ef997b534
2 files changed
+4 -3

No files matched your search

@@ -879,8 +879,6 @@ function commitUnmount(
if ((tag & HookPassive) !== NoHookEffect) {
// TODO: Consider if we can move this block out of the synchronous commit phase
effect.tag |= HookHasEffect;
schedulePassiveEffectCallback();
} else {
if (
enableProfilerTimer &&
@@ -2183,7 +2183,10 @@ function commitRootImpl(root, renderPriorityLevel) {
}
// If there are pending passive effects, schedule a callback to process them.
if ((finishedWork.subtreeTag & PassiveSubtreeTag) !== NoSubtreeTag) {
if (
(finishedWork.subtreeTag & PassiveSubtreeTag) !== NoSubtreeTag ||
(finishedWork.effectTag & PassiveMask) !== NoEffect
) {
if (!rootDoesHavePassiveEffects) {
rootDoesHavePassiveEffects = true;
scheduleCallback(NormalSchedulerPriority, () => {