diff --git a/src/backend/renderer.js b/src/backend/renderer.js index 728f1c0e59..a4626740b3 100644 --- a/src/backend/renderer.js +++ b/src/backend/renderer.js @@ -589,11 +589,6 @@ export function attach( let pendingSimulatedUnmountedIDs: Array = []; let pendingOperationsQueue: Array | null = []; - // We keep track of which Fibers have been reported as unmounted by React - // during this commit phase so that we don't try to "hide" them or their - // children when Suspense flips to fallback. These Fibers won't have IDs. - let fibersUnmountedInThisCommitPhase: WeakSet = new WeakSet(); - // TODO: we could make this layer DEV-only and write directly to pendingOperations. let nextOperation: Array = []; function beginNextOperation(size: number): void { @@ -683,7 +678,6 @@ export function attach( pendingOperations.length = 0; pendingRealUnmountedIDs.length = 0; pendingSimulatedUnmountedIDs.length = 0; - fibersUnmountedInThisCommitPhase = new WeakSet(); } function recordMount(fiber: Fiber, parentFiber: Fiber | null) { @@ -890,9 +884,8 @@ export function attach( while (child !== null) { // Record simulated unmounts children-first. - // We might find real committed unmounts along the way--skip them. - // Otherwise we would send duplicated messages for the same IDs. - if (!fibersUnmountedInThisCommitPhase.has(child)) { + // We skip nodes without return because those are real unmounts. + if (child.return !== null) { unmountFiberChildrenRecursively(child); recordUnmount(child, true); } @@ -1167,9 +1160,6 @@ export function attach( } function handleCommitFiberUnmount(fiber) { - // Remeber this is a real deletion so we don't - // go down this tree when hiding Suspense nodes. - fibersUnmountedInThisCommitPhase.add(fiber); // This is not recursive. // We can't traverse fibers after unmounting so instead // we rely on React telling us about each unmount.