Summary
React Scheduler (and browser scheduler.postTask) coordinate with isInputPending — cooperative multitasking. shouldYield ends slice. Not OS thread scheduler — still single main thread. Understanding helps debug why transitions defer but clicks don't.
Code example
if ('scheduler' in globalThis && 'postTask' in scheduler) {
scheduler.postTask(() => heavyWork(), { priority: 'background' });
} else {
requestIdleCallback(() => heavyWork());
}
Key points
- React Scheduler (and browser
scheduler.postTask) coordinate withisInputPending— cooperative multitasking. shouldYieldends slice.- Not OS thread scheduler — still single main thread.
- Understanding helps debug why transitions defer but clicks don't.