Skip to content

Commit 00a5b08

Browse files
committed
Remove PassiveStatic optimization
Passive flags are a new concept that is tricky to get right. We've already found two bugs related to PassiveStatic. Let's remove this optimization for now, and add it back once the main part of the effects refactor lands.
1 parent a6329b1 commit 00a5b08

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ import {
7070
Snapshot,
7171
Update,
7272
Passive,
73-
PassiveStatic,
7473
PassiveMask,
7574
PassiveUnmountPendingDev,
7675
} from './ReactFiberFlags';
@@ -2007,7 +2006,8 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(
20072006
while (nextEffect !== null) {
20082007
const fiber = nextEffect;
20092008
const child = fiber.child;
2010-
if ((fiber.subtreeFlags & PassiveStatic) !== NoFlags && child !== null) {
2009+
// TODO: Only traverse subtree if it has a PassiveStatic flag
2010+
if (child !== null) {
20112011
ensureCorrectReturnPointer(child, fiber);
20122012
nextEffect = child;
20132013
} else {
@@ -2023,11 +2023,10 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_complete(
20232023
) {
20242024
while (nextEffect !== null) {
20252025
const fiber = nextEffect;
2026-
if ((fiber.flags & PassiveStatic) !== NoFlags) {
2027-
setCurrentDebugFiberInDEV(fiber);
2028-
commitPassiveUnmountInsideDeletedTreeOnFiber(fiber);
2029-
resetCurrentDebugFiberInDEV();
2030-
}
2026+
// TODO: Check if fiber has a PassiveStatic flag
2027+
setCurrentDebugFiberInDEV(fiber);
2028+
commitPassiveUnmountInsideDeletedTreeOnFiber(fiber);
2029+
resetCurrentDebugFiberInDEV();
20312030

20322031
if (fiber === deletedSubtreeRoot) {
20332032
nextEffect = null;

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ import {
7070
Snapshot,
7171
Update,
7272
Passive,
73-
PassiveStatic,
7473
PassiveMask,
7574
PassiveUnmountPendingDev,
7675
} from './ReactFiberFlags';
@@ -2007,7 +2006,8 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(
20072006
while (nextEffect !== null) {
20082007
const fiber = nextEffect;
20092008
const child = fiber.child;
2010-
if ((fiber.subtreeFlags & PassiveStatic) !== NoFlags && child !== null) {
2009+
// TODO: Only traverse subtree if it has a PassiveStatic flag
2010+
if (child !== null) {
20112011
ensureCorrectReturnPointer(child, fiber);
20122012
nextEffect = child;
20132013
} else {
@@ -2023,11 +2023,10 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_complete(
20232023
) {
20242024
while (nextEffect !== null) {
20252025
const fiber = nextEffect;
2026-
if ((fiber.flags & PassiveStatic) !== NoFlags) {
2027-
setCurrentDebugFiberInDEV(fiber);
2028-
commitPassiveUnmountInsideDeletedTreeOnFiber(fiber);
2029-
resetCurrentDebugFiberInDEV();
2030-
}
2026+
// TODO: Check if fiber has a PassiveStatic flag
2027+
setCurrentDebugFiberInDEV(fiber);
2028+
commitPassiveUnmountInsideDeletedTreeOnFiber(fiber);
2029+
resetCurrentDebugFiberInDEV();
20312030

20322031
if (fiber === deletedSubtreeRoot) {
20332032
nextEffect = null;

0 commit comments

Comments
 (0)