Skip to content

Commit 4a5435a

Browse files
committed
Fix passive deletion effect ordering
1 parent 893fe96 commit 4a5435a

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,6 +2005,13 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(
20052005
) {
20062006
while (nextEffect !== null) {
20072007
const fiber = nextEffect;
2008+
2009+
// Deletion effects fire in parent -> child order
2010+
// TODO: Check if fiber has a PassiveStatic flag
2011+
setCurrentDebugFiberInDEV(fiber);
2012+
commitPassiveUnmountInsideDeletedTreeOnFiber(fiber);
2013+
resetCurrentDebugFiberInDEV();
2014+
20082015
const child = fiber.child;
20092016
// TODO: Only traverse subtree if it has a PassiveStatic flag
20102017
if (child !== null) {
@@ -2023,11 +2030,6 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_complete(
20232030
) {
20242031
while (nextEffect !== null) {
20252032
const fiber = nextEffect;
2026-
// TODO: Check if fiber has a PassiveStatic flag
2027-
setCurrentDebugFiberInDEV(fiber);
2028-
commitPassiveUnmountInsideDeletedTreeOnFiber(fiber);
2029-
resetCurrentDebugFiberInDEV();
2030-
20312033
if (fiber === deletedSubtreeRoot) {
20322034
nextEffect = null;
20332035
return;

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,6 +2005,13 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(
20052005
) {
20062006
while (nextEffect !== null) {
20072007
const fiber = nextEffect;
2008+
2009+
// Deletion effects fire in parent -> child order
2010+
// TODO: Check if fiber has a PassiveStatic flag
2011+
setCurrentDebugFiberInDEV(fiber);
2012+
commitPassiveUnmountInsideDeletedTreeOnFiber(fiber);
2013+
resetCurrentDebugFiberInDEV();
2014+
20082015
const child = fiber.child;
20092016
// TODO: Only traverse subtree if it has a PassiveStatic flag
20102017
if (child !== null) {
@@ -2023,11 +2030,6 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_complete(
20232030
) {
20242031
while (nextEffect !== null) {
20252032
const fiber = nextEffect;
2026-
// TODO: Check if fiber has a PassiveStatic flag
2027-
setCurrentDebugFiberInDEV(fiber);
2028-
commitPassiveUnmountInsideDeletedTreeOnFiber(fiber);
2029-
resetCurrentDebugFiberInDEV();
2030-
20312033
if (fiber === deletedSubtreeRoot) {
20322034
nextEffect = null;
20332035
return;

0 commit comments

Comments
 (0)