Skip to content

Commit

Permalink
[Synchronous Suspense] Don't delete children of suspended component
Browse files Browse the repository at this point in the history
Vestigial behavior that should have been removed in #13823.

Found using the Suspense fuzz tester in #14147.
  • Loading branch information
acdlite committed Nov 8, 2018
1 parent 3d8bda7 commit 9e947d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
12 changes: 1 addition & 11 deletions packages/react-reconciler/src/ReactFiberUnwindWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,20 +238,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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
]);
expect(ReactNoop.getChildrenAsJSX()).toEqual(
<React.Fragment>
<span hidden={true} prop="Step: 1" />
<span hidden={true} prop="Sibling" />
<span prop="Loading (1)" />
<span prop="Loading (2)" />
Expand Down Expand Up @@ -1060,6 +1061,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop.getChildrenAsJSX()).toEqual(
<React.Fragment>
<span hidden={true} prop="Before" />
<span hidden={true} prop="Async: 1" />
<span hidden={true} prop="After" />
<span prop="Loading..." />

Expand Down Expand Up @@ -1194,6 +1196,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop.getChildrenAsJSX()).toEqual(
<React.Fragment>
<span hidden={true} prop="Before" />
<span hidden={true} prop="Async: 1" />
<span hidden={true} prop="After" />
<span prop="Loading..." />

Expand Down

0 comments on commit 9e947d1

Please sign in to comment.