[Synchronous Suspense] Don't delete children of suspended component (#14157)
Vestigial behavior that should have been removed in #13823. Found using the Suspense fuzz tester in #14147.
Andrew Clark committed
Nov 8, 2018 at 11:38 UTC
f9e9913f0eaee7c2fabb801dccec97fd61873c5f
2 files changed
+4
-12
packages/react-reconciler/src/ReactFiberUnwindWork.js
+1
-12
@@ -70,7 +70,6 @@ import {
70
LOW_PRIORITY_EXPIRATION,
71
} from './ReactFiberExpirationTime';
72
import {findEarliestOutstandingPriorityLevel} from './ReactFiberPendingPriority';
73
-import {reconcileChildren} from './ReactFiberBeginWork';
73
74
function createRootErrorUpdate(
75
fiber: Fiber,
@@ -238,20 +237,10 @@ function throwException(
237
if ((workInProgress.mode & ConcurrentMode) === NoEffect) {
238
workInProgress.effectTag |= DidCapture;
239
241
- // Unmount the source fiber's children
242
- const nextChildren = null;
243
- reconcileChildren(
244
- sourceFiber.alternate,
245
- sourceFiber,
246
- nextChildren,
247
- renderExpirationTime,
248
- );
249
- sourceFiber.effectTag &= ~Incomplete;
250
-
240
// We're going to commit this fiber even though it didn't complete.
241
// But we shouldn't call any lifecycle methods or callbacks. Remove
242
// all lifecycle effect tags.
254
- sourceFiber.effectTag &= ~LifecycleEffectMask;
243
+ sourceFiber.effectTag &= ~(LifecycleEffectMask | Incomplete);
244
245
if (sourceFiber.tag === ClassComponent) {
246
const current = sourceFiber.alternate;
packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.internal.js
+3
@@ -937,6 +937,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
937
]);
938
expect(ReactNoop.getChildrenAsJSX()).toEqual(
939
<React.Fragment>
940
+ <span hidden={true} prop="Step: 1" />
941
<span hidden={true} prop="Sibling" />
942
<span prop="Loading (1)" />
943
<span prop="Loading (2)" />
@@ -1060,6 +1061,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
1061
expect(ReactNoop.getChildrenAsJSX()).toEqual(
1062
<React.Fragment>
1063
<span hidden={true} prop="Before" />
1064
+ <span hidden={true} prop="Async: 1" />
1065
<span hidden={true} prop="After" />
1066
<span prop="Loading..." />
1067
@@ -1194,6 +1196,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
1196
expect(ReactNoop.getChildrenAsJSX()).toEqual(
1197
<React.Fragment>
1198
<span hidden={true} prop="Before" />
1199
+ <span hidden={true} prop="Async: 1" />
1200
<span hidden={true} prop="After" />
1201
<span prop="Loading..." />
1202