@samitouri / QOS-React-2 / commits / 19e15a3986

Add PassiveStatic to trees with passive effects

Indicates that a tree needs passive clean-up on deletion.

Andrew Clark committed Dec 7, 2020 at 16:07 UTC 19e15a39865e4f5b7c4419f8db7d9f122e27e9a4
4 files changed +8 -4
packages/react-reconciler/src/ReactFiberHooks.new.js
+2 -1
@@ -49,6 +49,7 @@ import {readContext} from './ReactFiberNewContext.new';
49 import {
50 Update as UpdateEffect,
51 Passive as PassiveEffect,
52 + PassiveStatic as PassiveStaticEffect,
53 } from './ReactFiberFlags';
54 import {
55 HasEffect as HookHasEffect,
@@ -1304,7 +1305,7 @@ function mountEffect(
1305 }
1306 }
1307 return mountEffectImpl(
1307 - UpdateEffect | PassiveEffect,
1308 + UpdateEffect | PassiveEffect | PassiveStaticEffect,
1309 HookPassive,
1310 create,
1311 deps,
packages/react-reconciler/src/ReactFiberHooks.old.js
+2 -1
@@ -49,6 +49,7 @@ import {readContext} from './ReactFiberNewContext.old';
49 import {
50 Update as UpdateEffect,
51 Passive as PassiveEffect,
52 + PassiveStatic as PassiveStaticEffect,
53 } from './ReactFiberFlags';
54 import {
55 HasEffect as HookHasEffect,
@@ -1304,7 +1305,7 @@ function mountEffect(
1305 }
1306 }
1307 return mountEffectImpl(
1307 - UpdateEffect | PassiveEffect,
1308 + UpdateEffect | PassiveEffect | PassiveStaticEffect,
1309 HookPassive,
1310 create,
1311 deps,
packages/react-reconciler/src/ReactFiberWorkLoop.new.js
+2 -1
@@ -132,6 +132,7 @@ import {
132 HostEffectMask,
133 Hydrating,
134 HydratingAndUpdate,
135 + StaticMask,
136 } from './ReactFiberFlags';
137 import {
138 NoLanePriority,
@@ -1781,7 +1782,7 @@ function completeUnitOfWork(unitOfWork: Fiber): void {
1782 // Skip both NoWork and PerformedWork tags when creating the effect
1783 // list. PerformedWork effect is read by React DevTools but shouldn't be
1784 // committed.
1784 - if (flags > PerformedWork) {
1785 + if ((flags & ~StaticMask) > PerformedWork) {
1786 if (returnFiber.lastEffect !== null) {
1787 returnFiber.lastEffect.nextEffect = completedWork;
1788 } else {
packages/react-reconciler/src/ReactFiberWorkLoop.old.js
+2 -1
@@ -132,6 +132,7 @@ import {
132 HostEffectMask,
133 Hydrating,
134 HydratingAndUpdate,
135 + StaticMask,
136 } from './ReactFiberFlags';
137 import {
138 NoLanePriority,
@@ -1781,7 +1782,7 @@ function completeUnitOfWork(unitOfWork: Fiber): void {
1782 // Skip both NoWork and PerformedWork tags when creating the effect
1783 // list. PerformedWork effect is read by React DevTools but shouldn't be
1784 // committed.
1784 - if (flags > PerformedWork) {
1785 + if ((flags & ~StaticMask) > PerformedWork) {
1786 if (returnFiber.lastEffect !== null) {
1787 returnFiber.lastEffect.nextEffect = completedWork;
1788 } else {