From 226e28acbb10d033ec1f89053341c689a30a5945 Mon Sep 17 00:00:00 2001 From: Flarnie Marchan Date: Wed, 28 Mar 2018 13:40:39 -0700 Subject: [PATCH] Move isWorking assignment out of branches to top --- packages/react-reconciler/src/ReactFiberScheduler.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/react-reconciler/src/ReactFiberScheduler.js b/packages/react-reconciler/src/ReactFiberScheduler.js index 6198b64f2057d..5a64c55394111 100644 --- a/packages/react-reconciler/src/ReactFiberScheduler.js +++ b/packages/react-reconciler/src/ReactFiberScheduler.js @@ -944,13 +944,13 @@ export default function( } 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(); @@ -962,7 +962,6 @@ export default function( 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; @@ -971,7 +970,6 @@ export default function( // The root did not complete. stopWorkLoopTimer(interruptedBy, didCompleteRoot); interruptedBy = null; - isWorking = false; invariant( false, 'Expired work should have completed. This error is likely caused ' + @@ -981,7 +979,6 @@ export default function( } 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;