Skip to content

Commit 226e28a

Browse files
committed
Move isWorking assignment out of branches to top
1 parent b91b4c4 commit 226e28a

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
@@ -944,13 +944,13 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
944944
} while (true);
945945

946946
// We're done performing work. Time to clean up.
947-
let didCompleteRoot = null;
947+
let didCompleteRoot = false;
948+
isWorking = false;
948949

949950
// Yield back to main thread.
950951
if (didFatal) {
951952
stopWorkLoopTimer(interruptedBy, didCompleteRoot);
952953
interruptedBy = null;
953-
isWorking = false;
954954
// There was a fatal error.
955955
if (__DEV__) {
956956
stack.resetStackAfterFatalErrorInDev();
@@ -962,7 +962,6 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
962962
didCompleteRoot = true;
963963
stopWorkLoopTimer(interruptedBy, didCompleteRoot);
964964
interruptedBy = null;
965-
isWorking = false;
966965
// The root successfully completed. It's ready for commit.
967966
root.pendingCommitExpirationTime = expirationTime;
968967
const finishedWork = root.current.alternate;
@@ -971,7 +970,6 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
971970
// The root did not complete.
972971
stopWorkLoopTimer(interruptedBy, didCompleteRoot);
973972
interruptedBy = null;
974-
isWorking = false;
975973
invariant(
976974
false,
977975
'Expired work should have completed. This error is likely caused ' +
@@ -981,7 +979,6 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
981979
} else {
982980
stopWorkLoopTimer(interruptedBy, didCompleteRoot);
983981
interruptedBy = null;
984-
isWorking = false;
985982
// There's more work to do, but we ran out of time. Yield back to
986983
// the renderer.
987984
return null;

0 commit comments

Comments
 (0)