From c41126f56f4ac04d1b2e07d7f97b72258d8eb12c Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Thu, 8 Nov 2018 11:00:08 -0800 Subject: [PATCH] [Synchronous Suspense] Don't delete children of suspended component Vestigial behavior that should have been removed in #13823. Found using the Suspense fuzz tester in #14147. --- .../react-reconciler/src/ReactFiberUnwindWork.js | 13 +------------ .../ReactSuspenseWithNoopRenderer-test.internal.js | 3 +++ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/packages/react-reconciler/src/ReactFiberUnwindWork.js b/packages/react-reconciler/src/ReactFiberUnwindWork.js index 6fb2e080687e5..4ddd5db8a9d28 100644 --- a/packages/react-reconciler/src/ReactFiberUnwindWork.js +++ b/packages/react-reconciler/src/ReactFiberUnwindWork.js @@ -70,7 +70,6 @@ import { LOW_PRIORITY_EXPIRATION, } from './ReactFiberExpirationTime'; import {findEarliestOutstandingPriorityLevel} from './ReactFiberPendingPriority'; -import {reconcileChildren} from './ReactFiberBeginWork'; function createRootErrorUpdate( fiber: Fiber, @@ -238,20 +237,10 @@ function throwException( if ((workInProgress.mode & ConcurrentMode) === NoEffect) { workInProgress.effectTag |= DidCapture; - // Unmount the source fiber's children - const nextChildren = null; - reconcileChildren( - sourceFiber.alternate, - sourceFiber, - nextChildren, - renderExpirationTime, - ); - sourceFiber.effectTag &= ~Incomplete; - // We're going to commit this fiber even though it didn't complete. // But we shouldn't call any lifecycle methods or callbacks. Remove // all lifecycle effect tags. - sourceFiber.effectTag &= ~LifecycleEffectMask; + sourceFiber.effectTag &= ~(LifecycleEffectMask | Incomplete); if (sourceFiber.tag === ClassComponent) { const current = sourceFiber.alternate; diff --git a/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.internal.js b/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.internal.js index de4b75337ef3f..9580c425a47b0 100644 --- a/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.internal.js @@ -937,6 +937,7 @@ describe('ReactSuspenseWithNoopRenderer', () => { ]); expect(ReactNoop.getChildrenAsJSX()).toEqual( +