Quick fix for minor typo in ReactScheduler (#12834)
**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.
Flarnie Marchan committed
May 16, 2018 at 14:18 UTC
2da155a4c317e097f4490c74d173e5a902003572
1 file changed
+1
-1
packages/react-scheduler/src/ReactScheduler.js
+1
-1
@@ -209,11 +209,11 @@ if (!ExecutionEnvironment.canUseDOM) {
209
if (event.source !== window || event.data !== messageKey) {
210
return;
211
}
212
+ isIdleScheduled = false;
213
214
if (pendingCallbacks.length === 0) {
215
return;
216
}
216
- isIdleScheduled = false;
217
218
// First call anything which has timed out, until we have caught up.
219
callTimedOutCallbacks();