Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f9e9913

Browse files
authored
[Synchronous Suspense] Don't delete children of suspended component (facebook#14157)
Vestigial behavior that should have been removed in facebook#13823. Found using the Suspense fuzz tester in facebook#14147.
1 parent 7c56013 commit f9e9913

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

packages/react-reconciler/src/ReactFiberUnwindWork.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ import {
7070
LOW_PRIORITY_EXPIRATION,
7171
} from './ReactFiberExpirationTime';
7272
import {findEarliestOutstandingPriorityLevel} from './ReactFiberPendingPriority';
73-
import {reconcileChildren} from './ReactFiberBeginWork';
7473

7574
function createRootErrorUpdate(
7675
fiber: Fiber,
@@ -238,20 +237,10 @@ function throwException(
238237
if ((workInProgress.mode & ConcurrentMode) === NoEffect) {
239238
workInProgress.effectTag |= DidCapture;
240239

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-
251240
// We're going to commit this fiber even though it didn't complete.
252241
// But we shouldn't call any lifecycle methods or callbacks. Remove
253242
// all lifecycle effect tags.
254-
sourceFiber.effectTag &= ~LifecycleEffectMask;
243+
sourceFiber.effectTag &= ~(LifecycleEffectMask | Incomplete);
255244

256245
if (sourceFiber.tag === ClassComponent) {
257246
const current = sourceFiber.alternate;

packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.internal.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
937937
]);
938938
expect(ReactNoop.getChildrenAsJSX()).toEqual(
939939
<React.Fragment>
940+
<span hidden={true} prop="Step: 1" />
940941
<span hidden={true} prop="Sibling" />
941942
<span prop="Loading (1)" />
942943
<span prop="Loading (2)" />
@@ -1060,6 +1061,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
10601061
expect(ReactNoop.getChildrenAsJSX()).toEqual(
10611062
<React.Fragment>
10621063
<span hidden={true} prop="Before" />
1064+
<span hidden={true} prop="Async: 1" />
10631065
<span hidden={true} prop="After" />
10641066
<span prop="Loading..." />
10651067

@@ -1194,6 +1196,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
11941196
expect(ReactNoop.getChildrenAsJSX()).toEqual(
11951197
<React.Fragment>
11961198
<span hidden={true} prop="Before" />
1199+
<span hidden={true} prop="Async: 1" />
11971200
<span hidden={true} prop="After" />
11981201
<span prop="Loading..." />
11991202

0 commit comments

Comments
 (0)