dillon1000/react
Commit
Browse files [Scheduler] Yield less if there's no pending input (#15959)
At the end of each frame, Scheduler yields control of the main thread so the browser can execute important tasks; most importantly, painting the screen and responding to user input. There's some overhead involved in regaining control of the main thread, so we'd like to yield as infrequently as possible to keep the UI responsive. The reason we yield on every frame is because there's no way for us to know whether we're blocking user input. `isInputPending` is an experimental browser API that gives us this information. It tells us whether there's a pending user input, which also means it tells us if there's *not* a pending user input. We can use this signal to decide whether it's OK not to yield. There's a max frame length after which we'll yield regardless, as a precaution against blocking non-input tasks that we don't know about.
Changed paths1 file
First-parent comparisonpackages/scheduler/src/forks/SchedulerHostConfig.default.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…