From 19e15a39865e4f5b7c4419f8db7d9f122e27e9a4 Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Mon, 7 Dec 2020 16:07:55 -0600 Subject: [PATCH] Add PassiveStatic to trees with passive effects Indicates that a tree needs passive clean-up on deletion. --- packages/react-reconciler/src/ReactFiberHooks.new.js | 3 ++- packages/react-reconciler/src/ReactFiberHooks.old.js | 3 ++- packages/react-reconciler/src/ReactFiberWorkLoop.new.js | 3 ++- packages/react-reconciler/src/ReactFiberWorkLoop.old.js | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/react-reconciler/src/ReactFiberHooks.new.js b/packages/react-reconciler/src/ReactFiberHooks.new.js index 4a0a9231f0445..66c85b274df0e 100644 --- a/packages/react-reconciler/src/ReactFiberHooks.new.js +++ b/packages/react-reconciler/src/ReactFiberHooks.new.js @@ -49,6 +49,7 @@ import {readContext} from './ReactFiberNewContext.new'; import { Update as UpdateEffect, Passive as PassiveEffect, + PassiveStatic as PassiveStaticEffect, } from './ReactFiberFlags'; import { HasEffect as HookHasEffect, @@ -1304,7 +1305,7 @@ function mountEffect( } } return mountEffectImpl( - UpdateEffect | PassiveEffect, + UpdateEffect | PassiveEffect | PassiveStaticEffect, HookPassive, create, deps, diff --git a/packages/react-reconciler/src/ReactFiberHooks.old.js b/packages/react-reconciler/src/ReactFiberHooks.old.js index 8206eb00f67e0..49e222fa6735f 100644 --- a/packages/react-reconciler/src/ReactFiberHooks.old.js +++ b/packages/react-reconciler/src/ReactFiberHooks.old.js @@ -49,6 +49,7 @@ import {readContext} from './ReactFiberNewContext.old'; import { Update as UpdateEffect, Passive as PassiveEffect, + PassiveStatic as PassiveStaticEffect, } from './ReactFiberFlags'; import { HasEffect as HookHasEffect, @@ -1304,7 +1305,7 @@ function mountEffect( } } return mountEffectImpl( - UpdateEffect | PassiveEffect, + UpdateEffect | PassiveEffect | PassiveStaticEffect, HookPassive, create, deps, diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.new.js b/packages/react-reconciler/src/ReactFiberWorkLoop.new.js index e8d097e9ef563..042361ebdb1b3 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.new.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.new.js @@ -132,6 +132,7 @@ import { HostEffectMask, Hydrating, HydratingAndUpdate, + StaticMask, } from './ReactFiberFlags'; import { NoLanePriority, @@ -1781,7 +1782,7 @@ function completeUnitOfWork(unitOfWork: Fiber): void { // Skip both NoWork and PerformedWork tags when creating the effect // list. PerformedWork effect is read by React DevTools but shouldn't be // committed. - if (flags > PerformedWork) { + if ((flags & ~StaticMask) > PerformedWork) { if (returnFiber.lastEffect !== null) { returnFiber.lastEffect.nextEffect = completedWork; } else { diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.old.js b/packages/react-reconciler/src/ReactFiberWorkLoop.old.js index b5e87af0958a8..65157db61925d 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.old.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.old.js @@ -132,6 +132,7 @@ import { HostEffectMask, Hydrating, HydratingAndUpdate, + StaticMask, } from './ReactFiberFlags'; import { NoLanePriority, @@ -1781,7 +1782,7 @@ function completeUnitOfWork(unitOfWork: Fiber): void { // Skip both NoWork and PerformedWork tags when creating the effect // list. PerformedWork effect is read by React DevTools but shouldn't be // committed. - if (flags > PerformedWork) { + if ((flags & ~StaticMask) > PerformedWork) { if (returnFiber.lastEffect !== null) { returnFiber.lastEffect.nextEffect = completedWork; } else {