@samitouri / QOS-React-2 / commits / 00a5b08e24

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.

Andrew Clark committed Dec 11, 2020 at 15:45 UTC 00a5b08e24eb7429678aaed88360ae485dc08e68
2 files changed +12 -14
packages/react-reconciler/src/ReactFiberCommitWork.new.js
+6 -7
@@ -70,7 +70,6 @@ import {
70 Snapshot,
71 Update,
72 Passive,
73 - PassiveStatic,
73 PassiveMask,
74 PassiveUnmountPendingDev,
75 } from './ReactFiberFlags';
@@ -2007,7 +2006,8 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(
2006 while (nextEffect !== null) {
2007 const fiber = nextEffect;
2008 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) {
2011 ensureCorrectReturnPointer(child, fiber);
2012 nextEffect = child;
2013 } else {
@@ -2023,11 +2023,10 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_complete(
2023 ) {
2024 while (nextEffect !== null) {
2025 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();
2030
2031 if (fiber === deletedSubtreeRoot) {
2032 nextEffect = null;
packages/react-reconciler/src/ReactFiberCommitWork.old.js
+6 -7
@@ -70,7 +70,6 @@ import {
70 Snapshot,
71 Update,
72 Passive,
73 - PassiveStatic,
73 PassiveMask,
74 PassiveUnmountPendingDev,
75 } from './ReactFiberFlags';
@@ -2007,7 +2006,8 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(
2006 while (nextEffect !== null) {
2007 const fiber = nextEffect;
2008 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) {
2011 ensureCorrectReturnPointer(child, fiber);
2012 nextEffect = child;
2013 } else {
@@ -2023,11 +2023,10 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_complete(
2023 ) {
2024 while (nextEffect !== null) {
2025 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();
2030
2031 if (fiber === deletedSubtreeRoot) {
2032 nextEffect = null;