dillon1000/react

Commit

[schedule] Refactor Schedule, remove React-isms (#13582)

* Refactor Schedule, remove React-isms

Once the API stabilizes, we will move Schedule this into a separate
repo. To promote adoption, especially by projects outside the React
ecosystem, we'll remove all React-isms from the source and keep it as
simple as possible:

- No build step.
- No static types.
- Everything is in a single file.

If we end up needing to support multiple targets, like CommonJS and ESM,
we can still avoid a build step by maintaining two copies of the same
file, but with different exports.

This commit also refactors the implementation to split out the DOM-
specific parts (essentially a requestIdleCallback polyfill). Aside from
the architectural benefits, this also makes it possible to write host-
agnostic tests. If/when we publish a version of Schedule that targets
other environments, like React Native, we can run these same tests
across all implementations.

* Edits in response to Dan's PR feedback
Browse files
Changed paths7 files
First-parent comparison
M packages/react-dom/src/__tests__/ReactDOM-test.js ModifiedM packages/react-reconciler/src/ReactFiberScheduler.js ModifiedM packages/schedule/index.js ModifiedM packages/schedule/src/Schedule.js ModifiedA packages/schedule/src/__tests__/Schedule-test.internal.js AddedR packages/schedule/src/__tests__/Schedule-test.js →packages/schedule/src/__tests__/ScheduleDOM-test.js RenamedM packages/shared/__tests__/ReactDOMFrameScheduling-test.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…