dillon1000/react

Commit

[scheduler] Post to MessageChannel instead of window (#14234)

Scheduler needs to schedule a task that fires after paint. To do this,
it currently posts a message event to `window`. This happens on every
frame until the queue is empty. An unfortunate consequence is that every
other message event handler also gets called on every frame; even if
they exit immediately, this adds up to significant per-frame overhead.

Instead, we'll create a MessageChannel and post to that, with a
fallback to the old behavior if MessageChannel does not exist.
Browse files
Changed paths2 files
First-parent comparison
M packages/scheduler/src/Scheduler.js ModifiedM packages/scheduler/src/__tests__/SchedulerDOM-test.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…