Skip to content

Commit

Permalink
[Synchronous Suspense] Don't delete children of suspended component (f…
Browse files Browse the repository at this point in the history
…acebook#14157)

Vestigial behavior that should have been removed in facebook#13823.

Found using the Suspense fuzz tester in facebook#14147.
  • Loading branch information
acdlite authored and n8schloss committed Jan 31, 2019
1 parent a1b74e9 commit 1b3a807
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
13 changes: 1 addition & 12 deletions packages/react-reconciler/src/ReactFiberUnwindWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ import {
LOW_PRIORITY_EXPIRATION,
} from './ReactFiberExpirationTime';
import {findEarliestOutstandingPriorityLevel} from './ReactFiberPendingPriority';
import {reconcileChildren} from './ReactFiberBeginWork';

function createRootErrorUpdate(
fiber: Fiber,
Expand Down Expand Up @@ -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;
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 1b3a807

Please sign in to comment.