Skip to content

Commit

Permalink
Move isWorking assignment out of branches to top
Browse files Browse the repository at this point in the history
  • Loading branch information
flarnie committed Mar 28, 2018
1 parent b91b4c4 commit 226e28a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/react-reconciler/src/ReactFiberScheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -944,13 +944,13 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
} while (true);

// We're done performing work. Time to clean up.
let didCompleteRoot = null;
let didCompleteRoot = false;
isWorking = false;

// Yield back to main thread.
if (didFatal) {
stopWorkLoopTimer(interruptedBy, didCompleteRoot);
interruptedBy = null;
isWorking = false;
// There was a fatal error.
if (__DEV__) {
stack.resetStackAfterFatalErrorInDev();
Expand All @@ -962,7 +962,6 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
didCompleteRoot = true;
stopWorkLoopTimer(interruptedBy, didCompleteRoot);
interruptedBy = null;
isWorking = false;
// The root successfully completed. It's ready for commit.
root.pendingCommitExpirationTime = expirationTime;
const finishedWork = root.current.alternate;
Expand All @@ -971,7 +970,6 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
// The root did not complete.
stopWorkLoopTimer(interruptedBy, didCompleteRoot);
interruptedBy = null;
isWorking = false;
invariant(
false,
'Expired work should have completed. This error is likely caused ' +
Expand All @@ -981,7 +979,6 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
} else {
stopWorkLoopTimer(interruptedBy, didCompleteRoot);
interruptedBy = null;
isWorking = false;
// There's more work to do, but we ran out of time. Yield back to
// the renderer.
return null;
Expand Down

0 comments on commit 226e28a

Please sign in to comment.