GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Remove SchedulerHostConfigs by rickhanlonii · Pull Request #20025 · react/react Conversation
Contributor
SummaryRefactors the scheduler to remove SchedulerHostConfigs in favor of separate Schedulers:
For the mean time, I've included a switch in Clients should be updated to select the correct version: import Scheduler from 'scheduler'; // DOM by default import Scheduler from 'scheduler/unstable_no_dom'; import Scheduler from 'scheduler/unstable_mock'; import Scheduler from 'scheduler/unstable_post_task';
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
There was an error while loading. Please reload this page.
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 1527bb9:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| export * from './src/Scheduler'; | ||
| const isBrowserEnvironment = | ||
| typeof window !== 'undefined' && typeof MessageChannel === 'function'; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Could I just drop this check and only export the DOM version if I update the callers during the sync?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The inline require breaks the build but I'll wait to hear back on this before fixing it.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
For www you can lift the checks into the outer module wrapper, but for OSS this seems like the right place to put them.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Actually I guess the right place is here? https://github.com/facebook/react/blob/master/packages/scheduler/npm/index.js
I don't know what the best practice is in the npm ecosystem. Ideally we would handle this at the bundler level, using something like the browser field.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thanks!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| "tracing.js", | ||
| "tracing-profiling.js", | ||
| "unstable_mock.js", | ||
| "unstable_no_dom.js", |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I considered calling the NoDOM version Native since the primary user will be React Native, what do you think about the naming @acdlite?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
To me the primary purpose is to act as a last resort if you accidentally call this in a Node.js environment, like if you run a test without wrapping in act.
React Native will eventually need its own scheduler, so I'd rather not call this one a React Native scheduler since it's not optimized for that at all.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Details of bundled changes.Comparing: 7e405d4...1527bb9 scheduler
react
React: size: -3.8%, gzip: -3.0% Size changes (stable) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Details of bundled changes.Comparing: 7e405d4...1527bb9 scheduler
react
React: size: -3.5%, gzip: -2.7% Size changes (experimental) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@acdlite There's one test left that's failing and it's related to requiring |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@rickhanlonii The test is failing when running against the source files because the checks that you added in It does pass during the So I would either modify the Jest config to go through the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Good point @acdlite, I added a This is ready for review now! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| if (process.env.NODE_ENV === 'production') { | ||
| if (typeof window === 'undefined' || typeof MessageChannel !== 'function') { | ||
| module.exports = require('./unstable_no_dom'); |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this pattern because it's the first time we start doing this kind of switching in the npm wrappers and it won't port nicely to ESM. The thing that we do for production is a static switch which we can move into a compiler but we can't do the same for this.
We should move this branching into the implementation which forces us to treat this nicely in an ESM world.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Summary: Base sync before adding Flight files. This sync includes the following changes: - **[454c221](react/react@454c2211c )**: Refactor SchedulerHostConfigs ([#20025](react/react#20025)) //<Ricky>// - **[56e9fee](react/react@56e9feead )**: Remove Blocks ([#20138](react/react#20138)) //<Sebastian Markbåge>// - **[3fbd47b](react/react@3fbd47b86 )**: Serialize pending server components by reference (lazy component) ([#20137](react/react#20137)) //<Sebastian Markbåge>// - **[930ce7c](react/react@930ce7c15 )**: Allow values to be encoded by "reference" to a value rather than the value itself ([#20136](react/react#20136)) //<Sebastian Markbåge>// - **[39eb6d1](react/react@39eb6d176 )**: Rename ([#20134](react/react#20134)) //<Sebastian Markbåge>// - **[ffd8423](react/react@ffd842335 )**: [Flight] Add support for Module References in transport protocol ([#20121](react/react#20121)) //<Sebastian Markbåge>// - **[343d7a4](react/react@343d7a4a7 )**: Fast Refresh: Don't block DevTools commit hook ([#20129](react/react#20129)) //<Brian Vaughn>// - **[779a472](react/react@779a472b0 )**: Prevent inlining into recursive commit functions ([#20105](react/react#20105)) //<Andrew Clark>// - **[25b18d3](react/react@25b18d31c )**: Traverse commit phase effects iteratively ([#20094](react/react#20094)) //<Andrew Clark>// Changelog: [General][Changed] - React Native sync for revisions 4e5d7fa...454c221 Reviewed By: rickhanlonii Differential Revision: D24698701 fbshipit-source-id: dfaf692b1051150355dece1657764a484b7ae603
| } | ||
| // There's no pending input. Only yield if we've reached the max | ||
| // yield interval. | ||
| return currentTime >= maxYieldInterval; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Should this be currentTime - deadline >= maxYieldInterval?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
* Remove SchedulerHostConfigs * Fix builds * Fix forks * Move SchedulerNoDom check to npm/index.js * Fix tests * Add @gate source * Gate build-only test to build test runs
* Remove SchedulerHostConfigs * Fix builds * Fix forks * Move SchedulerNoDom check to npm/index.js * Fix tests * Add @gate source * Gate build-only test to build test runs
* Remove SchedulerHostConfigs * Fix builds * Fix forks * Move SchedulerNoDom check to npm/index.js * Fix tests * Add @gate source * Gate build-only test to build test runs
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.