Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use native scheduler if defined in global scope #26554

Merged
merged 9 commits into from May 5, 2023

Conversation

sammy-SC
Copy link
Contributor

@sammy-SC sammy-SC commented Apr 5, 2023

React Native in open source should use native scheduler if it is available.

@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Apr 5, 2023
@react-sizebot
Copy link

react-sizebot commented Apr 5, 2023

Comparing: 4a1cc2d...d0989c5

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 162.95 kB 162.95 kB = 51.54 kB 51.54 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 164.48 kB 164.48 kB = 52.03 kB 52.04 kB
facebook-www/ReactDOM-prod.classic.js = 553.05 kB 553.05 kB = 98.24 kB 98.24 kB
facebook-www/ReactDOM-prod.modern.js = 536.90 kB 536.90 kB = 95.56 kB 95.56 kB
oss-experimental/scheduler/cjs/scheduler.native.development.js +∞% 0.00 kB 17.64 kB +∞% 0.00 kB 4.87 kB
oss-experimental/scheduler/cjs/scheduler.native.production.min.js +∞% 0.00 kB 4.73 kB +∞% 0.00 kB 1.74 kB
oss-experimental/scheduler/index.native.js +∞% 0.00 kB 0.21 kB +∞% 0.00 kB 0.15 kB
oss-stable-semver/scheduler/cjs/scheduler.native.development.js +∞% 0.00 kB 17.64 kB +∞% 0.00 kB 4.87 kB
oss-stable-semver/scheduler/cjs/scheduler.native.production.min.js +∞% 0.00 kB 4.73 kB +∞% 0.00 kB 1.74 kB
oss-stable-semver/scheduler/index.native.js +∞% 0.00 kB 0.21 kB +∞% 0.00 kB 0.15 kB
oss-stable/scheduler/cjs/scheduler.native.development.js +∞% 0.00 kB 17.64 kB +∞% 0.00 kB 4.87 kB
oss-stable/scheduler/cjs/scheduler.native.production.min.js +∞% 0.00 kB 4.73 kB +∞% 0.00 kB 1.74 kB
oss-stable/scheduler/index.native.js +∞% 0.00 kB 0.21 kB +∞% 0.00 kB 0.15 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-experimental/scheduler/cjs/scheduler.native.development.js +∞% 0.00 kB 17.64 kB +∞% 0.00 kB 4.87 kB
oss-experimental/scheduler/cjs/scheduler.native.production.min.js +∞% 0.00 kB 4.73 kB +∞% 0.00 kB 1.74 kB
oss-experimental/scheduler/index.native.js +∞% 0.00 kB 0.21 kB +∞% 0.00 kB 0.15 kB
oss-stable-semver/scheduler/cjs/scheduler.native.development.js +∞% 0.00 kB 17.64 kB +∞% 0.00 kB 4.87 kB
oss-stable-semver/scheduler/cjs/scheduler.native.production.min.js +∞% 0.00 kB 4.73 kB +∞% 0.00 kB 1.74 kB
oss-stable-semver/scheduler/index.native.js +∞% 0.00 kB 0.21 kB +∞% 0.00 kB 0.15 kB
oss-stable/scheduler/cjs/scheduler.native.development.js +∞% 0.00 kB 17.64 kB +∞% 0.00 kB 4.87 kB
oss-stable/scheduler/cjs/scheduler.native.production.min.js +∞% 0.00 kB 4.73 kB +∞% 0.00 kB 1.74 kB
oss-stable/scheduler/index.native.js +∞% 0.00 kB 0.21 kB +∞% 0.00 kB 0.15 kB

Generated by 🚫 dangerJS against d0989c5

gaearon
gaearon previously requested changes Apr 6, 2023
Copy link
Collaborator

@gaearon gaearon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do this via package.json export conditions instead? Does RN have one?

packages/scheduler/npm/index.js Outdated Show resolved Hide resolved
@sammy-SC
Copy link
Contributor Author

I added React Native override for index.js. This override checks if nativeRuntimeScheduler exists.

Do I need to bump up NPM version of this package and update the version that React uses?

@sammy-SC sammy-SC requested a review from gaearon April 17, 2023 15:18
@sammy-SC sammy-SC force-pushed the sammy/include-native-scheduler branch from c0304f1 to 139e4eb Compare April 20, 2023 12:17
@gaearon gaearon force-pushed the sammy/include-native-scheduler branch from 1fe57da to 2460eb2 Compare May 4, 2023 18:22
Copy link
Collaborator

@gaearon gaearon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks good on my side but pls test if it works.

note it would require an npm release — but we could also instead vendor Scheduler bundles into RN like we do with React bundles, and then it wouldn't.

@sammy-SC sammy-SC merged commit b00e273 into facebook:main May 5, 2023
36 checks passed
@sammy-SC sammy-SC deleted the sammy/include-native-scheduler branch May 5, 2023 13:01
github-actions bot pushed a commit that referenced this pull request May 5, 2023
Co-authored-by: Dan Abramov <dan.abramov@gmail.com>

DiffTrain build for [b00e273](b00e273)
acdlite added a commit to acdlite/next.js that referenced this pull request May 7, 2023
Fixes a bug where `useFormStatus` crashed during SSR.

Includes the following upstream changes:

- [16d053d59](https://github.com/facebook/react/commits/16d053d59) Add useFormStatus to server rendering stub ([vercel#26788](facebook/react#26788)) (Andrew Clark)
- [efb381bbf](https://github.com/facebook/react/commits/efb381bbf) [Release Script] Print a hint where to get the token ([vercel#26783](facebook/react#26783)) (dan)
- [b00e27342](https://github.com/facebook/react/commits/b00e27342) Use native scheduler if defined in global scope ([vercel#26554](facebook/react#26554)) (Samuel Susla)
- [783e7fcfa](https://github.com/facebook/react/commits/783e7fcfa) React DevTools 4.27.6 -> 4.27.7 ([vercel#26780](facebook/react#26780)) (Ruslan Lesiutin)
- [377c5175f](https://github.com/facebook/react/commits/377c5175f) DevTools: fix backend activation ([vercel#26779](facebook/react#26779)) (Ruslan Lesiutin)
acdlite added a commit to acdlite/next.js that referenced this pull request May 7, 2023
Fixes a bug where `useFormStatus` crashed during SSR.

Includes the following upstream changes:

- [16d053d59](https://github.com/facebook/react/commits/16d053d59) Add useFormStatus to server rendering stub ([vercel#26788](facebook/react#26788)) (Andrew Clark)
- [efb381bbf](https://github.com/facebook/react/commits/efb381bbf) [Release Script] Print a hint where to get the token ([vercel#26783](facebook/react#26783)) (dan)
- [b00e27342](https://github.com/facebook/react/commits/b00e27342) Use native scheduler if defined in global scope ([vercel#26554](facebook/react#26554)) (Samuel Susla)
- [783e7fcfa](https://github.com/facebook/react/commits/783e7fcfa) React DevTools 4.27.6 -> 4.27.7 ([vercel#26780](facebook/react#26780)) (Ruslan Lesiutin)
- [377c5175f](https://github.com/facebook/react/commits/377c5175f) DevTools: fix backend activation ([vercel#26779](facebook/react#26779)) (Ruslan Lesiutin)
acdlite added a commit to acdlite/next.js that referenced this pull request May 7, 2023
Fixes a bug where `useFormStatus` crashed during SSR.

Includes the following upstream changes:

- [16d053d59](https://github.com/facebook/react/commits/16d053d59) Add useFormStatus to server rendering stub ([vercel#26788](facebook/react#26788)) (Andrew Clark)
- [efb381bbf](https://github.com/facebook/react/commits/efb381bbf) [Release Script] Print a hint where to get the token ([vercel#26783](facebook/react#26783)) (dan)
- [b00e27342](https://github.com/facebook/react/commits/b00e27342) Use native scheduler if defined in global scope ([vercel#26554](facebook/react#26554)) (Samuel Susla)
- [783e7fcfa](https://github.com/facebook/react/commits/783e7fcfa) React DevTools 4.27.6 -> 4.27.7 ([vercel#26780](facebook/react#26780)) (Ruslan Lesiutin)
- [377c5175f](https://github.com/facebook/react/commits/377c5175f) DevTools: fix backend activation ([vercel#26779](facebook/react#26779)) (Ruslan Lesiutin)
kodiakhq bot pushed a commit to vercel/next.js that referenced this pull request May 7, 2023
Fixes a bug where `useFormStatus` crashed during SSR.

Includes the following upstream changes:

- [16d053d59](https://github.com/facebook/react/commits/16d053d59) Add useFormStatus to server rendering stub ([#26788](facebook/react#26788)) (Andrew Clark)
- [efb381bbf](https://github.com/facebook/react/commits/efb381bbf) [Release Script] Print a hint where to get the token ([#26783](facebook/react#26783)) (dan)
- [b00e27342](https://github.com/facebook/react/commits/b00e27342) Use native scheduler if defined in global scope ([#26554](facebook/react#26554)) (Samuel Susla)
- [783e7fcfa](https://github.com/facebook/react/commits/783e7fcfa) React DevTools 4.27.6 -> 4.27.7 ([#26780](facebook/react#26780)) (Ruslan Lesiutin)
- [377c5175f](https://github.com/facebook/react/commits/377c5175f) DevTools: fix backend activation ([#26779](facebook/react#26779)) (Ruslan Lesiutin)
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
bigfootjon pushed a commit that referenced this pull request Apr 18, 2024
Co-authored-by: Dan Abramov <dan.abramov@gmail.com>

DiffTrain build for commit b00e273.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants