Skip to content

Commit 5875830

Browse files
committed
Move isWorking assignment out of branches to top
1 parent 7eaba37 commit 5875830

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

packages/react-reconciler/src/ReactFiberScheduler.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -958,13 +958,13 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
958958
} while (true);
959959

960960
// We're done performing work. Time to clean up.
961-
let didCompleteRoot = null;
961+
let didCompleteRoot = false;
962+
isWorking = false;
962963

963964
// Yield back to main thread.
964965
if (didFatal) {
965966
stopWorkLoopTimer(interruptedBy, didCompleteRoot);
966967
interruptedBy = null;
967-
isWorking = false;
968968
// There was a fatal error.
969969
if (__DEV__) {
970970
stack.resetStackAfterFatalErrorInDev();
@@ -976,7 +976,6 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
976976
didCompleteRoot = true;
977977
stopWorkLoopTimer(interruptedBy, didCompleteRoot);
978978
interruptedBy = null;
979-
isWorking = false;
980979
// The root successfully completed. It's ready for commit.
981980
root.pendingCommitExpirationTime = expirationTime;
982981
const finishedWork = root.current.alternate;
@@ -985,7 +984,6 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
985984
// The root did not complete.
986985
stopWorkLoopTimer(interruptedBy, didCompleteRoot);
987986
interruptedBy = null;
988-
isWorking = false;
989987
invariant(
990988
false,
991989
'Expired work should have completed. This error is likely caused ' +
@@ -995,7 +993,6 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
995993
} else {
996994
stopWorkLoopTimer(interruptedBy, didCompleteRoot);
997995
interruptedBy = null;
998-
isWorking = false;
999996
// There's more work to do, but we ran out of time. Yield back to
1000997
// the renderer.
1001998
return null;

0 commit comments

Comments
 (0)