Skip to content

Commit 19e15a3

Browse files
committed
Add PassiveStatic to trees with passive effects
Indicates that a tree needs passive clean-up on deletion.
1 parent ff17fc1 commit 19e15a3

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import {readContext} from './ReactFiberNewContext.new';
4949
import {
5050
Update as UpdateEffect,
5151
Passive as PassiveEffect,
52+
PassiveStatic as PassiveStaticEffect,
5253
} from './ReactFiberFlags';
5354
import {
5455
HasEffect as HookHasEffect,
@@ -1304,7 +1305,7 @@ function mountEffect(
13041305
}
13051306
}
13061307
return mountEffectImpl(
1307-
UpdateEffect | PassiveEffect,
1308+
UpdateEffect | PassiveEffect | PassiveStaticEffect,
13081309
HookPassive,
13091310
create,
13101311
deps,

packages/react-reconciler/src/ReactFiberHooks.old.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import {readContext} from './ReactFiberNewContext.old';
4949
import {
5050
Update as UpdateEffect,
5151
Passive as PassiveEffect,
52+
PassiveStatic as PassiveStaticEffect,
5253
} from './ReactFiberFlags';
5354
import {
5455
HasEffect as HookHasEffect,
@@ -1304,7 +1305,7 @@ function mountEffect(
13041305
}
13051306
}
13061307
return mountEffectImpl(
1307-
UpdateEffect | PassiveEffect,
1308+
UpdateEffect | PassiveEffect | PassiveStaticEffect,
13081309
HookPassive,
13091310
create,
13101311
deps,

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ import {
132132
HostEffectMask,
133133
Hydrating,
134134
HydratingAndUpdate,
135+
StaticMask,
135136
} from './ReactFiberFlags';
136137
import {
137138
NoLanePriority,
@@ -1781,7 +1782,7 @@ function completeUnitOfWork(unitOfWork: Fiber): void {
17811782
// Skip both NoWork and PerformedWork tags when creating the effect
17821783
// list. PerformedWork effect is read by React DevTools but shouldn't be
17831784
// committed.
1784-
if (flags > PerformedWork) {
1785+
if ((flags & ~StaticMask) > PerformedWork) {
17851786
if (returnFiber.lastEffect !== null) {
17861787
returnFiber.lastEffect.nextEffect = completedWork;
17871788
} else {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ import {
132132
HostEffectMask,
133133
Hydrating,
134134
HydratingAndUpdate,
135+
StaticMask,
135136
} from './ReactFiberFlags';
136137
import {
137138
NoLanePriority,
@@ -1781,7 +1782,7 @@ function completeUnitOfWork(unitOfWork: Fiber): void {
17811782
// Skip both NoWork and PerformedWork tags when creating the effect
17821783
// list. PerformedWork effect is read by React DevTools but shouldn't be
17831784
// committed.
1784-
if (flags > PerformedWork) {
1785+
if ((flags & ~StaticMask) > PerformedWork) {
17851786
if (returnFiber.lastEffect !== null) {
17861787
returnFiber.lastEffect.nextEffect = completedWork;
17871788
} else {

0 commit comments

Comments
 (0)