From 00a5b08e24eb7429678aaed88360ae485dc08e68 Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Fri, 11 Dec 2020 15:45:08 -0600 Subject: [PATCH] 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. --- .../src/ReactFiberCommitWork.new.js | 13 ++++++------- .../src/ReactFiberCommitWork.old.js | 13 ++++++------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/packages/react-reconciler/src/ReactFiberCommitWork.new.js b/packages/react-reconciler/src/ReactFiberCommitWork.new.js index 6545ad876f879..d3082d5f785b8 100644 --- a/packages/react-reconciler/src/ReactFiberCommitWork.new.js +++ b/packages/react-reconciler/src/ReactFiberCommitWork.new.js @@ -70,7 +70,6 @@ import { Snapshot, Update, Passive, - PassiveStatic, PassiveMask, PassiveUnmountPendingDev, } from './ReactFiberFlags'; @@ -2007,7 +2006,8 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_begin( while (nextEffect !== null) { const fiber = nextEffect; const child = fiber.child; - if ((fiber.subtreeFlags & PassiveStatic) !== NoFlags && child !== null) { + // TODO: Only traverse subtree if it has a PassiveStatic flag + if (child !== null) { ensureCorrectReturnPointer(child, fiber); nextEffect = child; } else { @@ -2023,11 +2023,10 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_complete( ) { while (nextEffect !== null) { const fiber = nextEffect; - if ((fiber.flags & PassiveStatic) !== NoFlags) { - setCurrentDebugFiberInDEV(fiber); - commitPassiveUnmountInsideDeletedTreeOnFiber(fiber); - resetCurrentDebugFiberInDEV(); - } + // TODO: Check if fiber has a PassiveStatic flag + setCurrentDebugFiberInDEV(fiber); + commitPassiveUnmountInsideDeletedTreeOnFiber(fiber); + resetCurrentDebugFiberInDEV(); if (fiber === deletedSubtreeRoot) { nextEffect = null; diff --git a/packages/react-reconciler/src/ReactFiberCommitWork.old.js b/packages/react-reconciler/src/ReactFiberCommitWork.old.js index 3e68baae514ec..95e48b1e4ae4f 100644 --- a/packages/react-reconciler/src/ReactFiberCommitWork.old.js +++ b/packages/react-reconciler/src/ReactFiberCommitWork.old.js @@ -70,7 +70,6 @@ import { Snapshot, Update, Passive, - PassiveStatic, PassiveMask, PassiveUnmountPendingDev, } from './ReactFiberFlags'; @@ -2007,7 +2006,8 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_begin( while (nextEffect !== null) { const fiber = nextEffect; const child = fiber.child; - if ((fiber.subtreeFlags & PassiveStatic) !== NoFlags && child !== null) { + // TODO: Only traverse subtree if it has a PassiveStatic flag + if (child !== null) { ensureCorrectReturnPointer(child, fiber); nextEffect = child; } else { @@ -2023,11 +2023,10 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_complete( ) { while (nextEffect !== null) { const fiber = nextEffect; - if ((fiber.flags & PassiveStatic) !== NoFlags) { - setCurrentDebugFiberInDEV(fiber); - commitPassiveUnmountInsideDeletedTreeOnFiber(fiber); - resetCurrentDebugFiberInDEV(); - } + // TODO: Check if fiber has a PassiveStatic flag + setCurrentDebugFiberInDEV(fiber); + commitPassiveUnmountInsideDeletedTreeOnFiber(fiber); + resetCurrentDebugFiberInDEV(); if (fiber === deletedSubtreeRoot) { nextEffect = null;