mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
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:
co-authored by
Brian Vaughn
parent
e1f96b82b4
commit
6ef997b534
@@ -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, () => {
|
||||
|
||||
Reference in New Issue
Block a user