Skip to content

Commit

Permalink
Quick fix for minor typo in ReactScheduler (facebook#12834)
Browse files Browse the repository at this point in the history
**what is the change?:**
We were setting a flag after some early returns, should have set it
right away.

To be fair, it's not clear how you can hit a problem with the current
state of things. Even if a callback is cancelled, it's still in the
'pendingCallbacks' queue until the rAF runs, and we only schedule a rAF
when there are pendingCallbacks in the queue.

But since this is obviously wrong, going to fix it.

We will be adding a regression test in a follow-up PR.

**why make this change?:**
To fix a random bug which was popping up.

**test plan:**
Adding a regression unit test in a follow-up PR.
  • Loading branch information
flarnie authored May 16, 2018
1 parent d6f304e commit 2da155a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/react-scheduler/src/ReactScheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,11 @@ if (!ExecutionEnvironment.canUseDOM) {
if (event.source !== window || event.data !== messageKey) {
return;
}
isIdleScheduled = false;

if (pendingCallbacks.length === 0) {
return;
}
isIdleScheduled = false;

// First call anything which has timed out, until we have caught up.
callTimedOutCallbacks();
Expand Down

0 comments on commit 2da155a

Please sign in to comment.