From 62ef9e7c92c70f209b7495db454469ed78556a61 Mon Sep 17 00:00:00 2001 From: Luna Date: Tue, 5 Jul 2022 15:54:31 -0400 Subject: [PATCH 1/2] remove todo --- .../src/ReactFiberCommitWork.new.js | 44 ++++++------------- 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/packages/react-reconciler/src/ReactFiberCommitWork.new.js b/packages/react-reconciler/src/ReactFiberCommitWork.new.js index 3d6d9cde8b291..6aafef2096003 100644 --- a/packages/react-reconciler/src/ReactFiberCommitWork.new.js +++ b/packages/react-reconciler/src/ReactFiberCommitWork.new.js @@ -2884,34 +2884,21 @@ function commitPassiveMountOnFiber( if (queue !== null) { if (isFallback) { const transitions = queue.transitions; - let prevTransitions = instance.transitions; - if (instance.pendingMarkers === null) { - instance.pendingMarkers = new Set(); - } - if (transitions !== null && prevTransitions === null) { - instance.transitions = prevTransitions = new Set(); - } - if (transitions !== null) { transitions.forEach(transition => { // Add all the transitions saved in the update queue during // the render phase (ie the transitions associated with this boundary) // into the transitions set. - if (prevTransitions === null) { - // TODO: What if prevTransitions is null? - } else { - prevTransitions.add(transition); + if (instance.transitions === null) { + instance.transitions = new Set(); } + instance.transitions.add(transition); }); } const markerInstances = queue.markerInstances; if (markerInstances !== null) { markerInstances.forEach(markerInstance => { - if (markerInstance.pendingSuspenseBoundaries === null) { - markerInstance.pendingSuspenseBoundaries = new Map(); - } - const markerTransitions = markerInstance.transitions; // There should only be a few tracing marker transitions because // they should be only associated with the transition that @@ -2919,21 +2906,18 @@ function commitPassiveMountOnFiber( if (markerTransitions !== null) { markerTransitions.forEach(transition => { if (instance.transitions === null) { - // TODO: What if instance.transitions is null? - } else { - if (instance.transitions.has(transition)) { - if ( - instance.pendingMarkers === null || - markerInstance.pendingSuspenseBoundaries === null - ) { - // TODO: What if instance.pendingMarkers is null? - // TODO: What if markerInstance.pendingSuspenseBoundaries is null? - } else { - instance.pendingMarkers.add( - markerInstance.pendingSuspenseBoundaries, - ); - } + instance.transitions = new Set(); + } else if (instance.transitions.has(transition)) { + if (markerInstance.pendingSuspenseBoundaries === null) { + markerInstance.pendingSuspenseBoundaries = new Map(); + } + if (instance.pendingMarkers === null) { + instance.pendingMarkers = new Set(); } + + instance.pendingMarkers.add( + markerInstance.pendingSuspenseBoundaries, + ); } }); } From 27dc4ef74b558ab84550f456a3a78d1742d3b274 Mon Sep 17 00:00:00 2001 From: Luna Date: Tue, 5 Jul 2022 15:55:30 -0400 Subject: [PATCH 2/2] old --- .../src/ReactFiberCommitWork.old.js | 44 ++++++------------- 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/packages/react-reconciler/src/ReactFiberCommitWork.old.js b/packages/react-reconciler/src/ReactFiberCommitWork.old.js index 4c1cb2226c961..fae360708ae49 100644 --- a/packages/react-reconciler/src/ReactFiberCommitWork.old.js +++ b/packages/react-reconciler/src/ReactFiberCommitWork.old.js @@ -2884,34 +2884,21 @@ function commitPassiveMountOnFiber( if (queue !== null) { if (isFallback) { const transitions = queue.transitions; - let prevTransitions = instance.transitions; - if (instance.pendingMarkers === null) { - instance.pendingMarkers = new Set(); - } - if (transitions !== null && prevTransitions === null) { - instance.transitions = prevTransitions = new Set(); - } - if (transitions !== null) { transitions.forEach(transition => { // Add all the transitions saved in the update queue during // the render phase (ie the transitions associated with this boundary) // into the transitions set. - if (prevTransitions === null) { - // TODO: What if prevTransitions is null? - } else { - prevTransitions.add(transition); + if (instance.transitions === null) { + instance.transitions = new Set(); } + instance.transitions.add(transition); }); } const markerInstances = queue.markerInstances; if (markerInstances !== null) { markerInstances.forEach(markerInstance => { - if (markerInstance.pendingSuspenseBoundaries === null) { - markerInstance.pendingSuspenseBoundaries = new Map(); - } - const markerTransitions = markerInstance.transitions; // There should only be a few tracing marker transitions because // they should be only associated with the transition that @@ -2919,21 +2906,18 @@ function commitPassiveMountOnFiber( if (markerTransitions !== null) { markerTransitions.forEach(transition => { if (instance.transitions === null) { - // TODO: What if instance.transitions is null? - } else { - if (instance.transitions.has(transition)) { - if ( - instance.pendingMarkers === null || - markerInstance.pendingSuspenseBoundaries === null - ) { - // TODO: What if instance.pendingMarkers is null? - // TODO: What if markerInstance.pendingSuspenseBoundaries is null? - } else { - instance.pendingMarkers.add( - markerInstance.pendingSuspenseBoundaries, - ); - } + instance.transitions = new Set(); + } else if (instance.transitions.has(transition)) { + if (markerInstance.pendingSuspenseBoundaries === null) { + markerInstance.pendingSuspenseBoundaries = new Map(); + } + if (instance.pendingMarkers === null) { + instance.pendingMarkers = new Set(); } + + instance.pendingMarkers.add( + markerInstance.pendingSuspenseBoundaries, + ); } }); }