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

Add API to force Scheduler to yield for macrotask #25044

Merged
merged 1 commit into from
Aug 5, 2022

Conversation

acdlite
Copy link
Collaborator

@acdlite acdlite commented Aug 4, 2022

We need a way to yield control of the main thread and schedule a continuation in a separate macrotask. (This is related to some Suspense optimizations we have planned.)

Our solution needs to account for how Scheduler is implemented. Scheduler tasks are not 1:1 with real browser macrotasks — many Scheduler "tasks" can be executed within a single browser task. If a Scheduler task yields control and posts a continuation, but there's still time left in the frame, Scheduler will execute the continuation immediately (synchronously) without yielding control back to the main thread. That's not what we want — we want to schedule a new macrotask regardless of where we are in the browser's render cycle.

There are several ways we could approach this. What I ended up doing was adding a new Scheduler method unstable_requestYield. (It's similar to the existing unstable_requestPaint that we use to yield at the end of the frame.)

It works by setting the internal start time of the current work loop to a large negative number, so that when the shouldYield call computes how much time has elapsed, it's guaranteed to exceed the deadline. The advantage of doing it this way is that there are no additional checks in the normal hot path of the work loop.

The existing layering between Scheduler and React DOM is not ideal. None of the APIs are public, so despite the fact that Scheduler is a separate package, I consider that a private implementation detail, and think of them as part of the same unit.

So for now, I think it makes sense to implement this macrotask logic directly inside of Scheduler instead of layering it on top.

The rough eventual plan for Scheduler is turn it into a postTask prollyfill. Because postTask does not yet have an equivalent for shouldYield, we would split that out into its own layer, perhaps directly inside the reconciler. In that world, the macrotask logic I've added in this commit would likely live in that same layer. When the native postTask is available, we may not even need any additional logic because it uses actual browser tasks.

We need a way to yield control of the main thread and schedule a
continuation in a separate macrotask. (This is related to some Suspense
optimizations we have planned.)

Our solution needs account for how Scheduler is implemented. Scheduler
tasks are not 1:1 with real browser macrotasks — many Scheduler "tasks"
can be executed within a single browser task. If a Scheduler task yields
control and posts a continuation, but there's still time left in the
frame, Scheduler will execute the continuation immediately
(synchronously) without yielding control back to the main thread. That's
not what we want — we want to schedule a new macrotask regardless of
where we are in the browser's render cycle.

There are several ways we could approach this. What I ended up doing was
adding a new Scheduler method `unstable_requestYield`. (It's similar to
the existing `unstable_requestPaint` that we use to yield at the end of
the frame.)

It works by setting the internal start time of the current work loop to
a large negative number, so that when the `shouldYield` call computes
how much time has elapsed, it's guaranteed to exceed the deadline. The
advantage of doing it this way is that there are no additional checks in
the normal hot path of the work loop.

The existing layering between Scheduler and React DOM is not ideal. None
of the APIs are public, so despite the fact that Scheduler is a separate
package, I consider that a private implementation detail, and think of
them as part of the same unit.

So for now, though, I think it makes sense to implement this macrotask
logic directly inside of Scheduler instead of layering it on top.

The rough eventual plan for Scheduler is turn it into a `postTask`
prollyfill. Because `postTask` does not yet have an equivalent for
`shouldYield`, we would split that out into its own layer, perhaps
directly inside the reconciler. In that world, the macrotask logic I've
added in this commit would likely live in that same layer. When the
native `postTask` is available, we may not even need any additional
logic because it uses actual browser tasks.
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Aug 4, 2022
@sizebot
Copy link

sizebot commented Aug 4, 2022

Comparing: 9fcaf88...5a73703

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 = 134.09 kB 134.09 kB = 42.93 kB 42.93 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 139.65 kB 139.65 kB = 44.55 kB 44.55 kB
facebook-www/ReactDOM-prod.classic.js = 474.97 kB 474.97 kB = 84.88 kB 84.88 kB
facebook-www/ReactDOM-prod.modern.js = 460.21 kB 460.21 kB = 82.64 kB 82.64 kB
facebook-www/ReactDOMForked-prod.classic.js = 474.97 kB 474.97 kB = 84.88 kB 84.88 kB
oss-experimental/scheduler/umd/scheduler.production.min.js +5.20% 4.63 kB 4.88 kB +1.73% 0.87 kB 0.88 kB
oss-experimental/scheduler/umd/scheduler.profiling.min.js +5.20% 4.63 kB 4.88 kB +1.73% 0.87 kB 0.88 kB
oss-stable-semver/scheduler/umd/scheduler.production.min.js +5.20% 4.63 kB 4.88 kB +1.73% 0.87 kB 0.88 kB
oss-stable-semver/scheduler/umd/scheduler.profiling.min.js +5.20% 4.63 kB 4.88 kB +1.73% 0.87 kB 0.88 kB
oss-stable/scheduler/umd/scheduler.production.min.js +5.20% 4.63 kB 4.88 kB +1.73% 0.87 kB 0.88 kB
oss-stable/scheduler/umd/scheduler.profiling.min.js +5.20% 4.63 kB 4.88 kB +1.73% 0.87 kB 0.88 kB
oss-experimental/scheduler/umd/scheduler.development.js +4.92% 4.90 kB 5.14 kB +1.61% 0.87 kB 0.88 kB
oss-stable-semver/scheduler/umd/scheduler.development.js +4.92% 4.90 kB 5.14 kB +1.61% 0.87 kB 0.88 kB
oss-stable/scheduler/umd/scheduler.development.js +4.92% 4.90 kB 5.14 kB +1.61% 0.87 kB 0.88 kB
oss-experimental/scheduler/cjs/scheduler-unstable_post_task.production.min.js +2.59% 1.97 kB 2.02 kB +1.42% 0.85 kB 0.86 kB
oss-stable-semver/scheduler/cjs/scheduler-unstable_post_task.production.min.js +2.59% 1.97 kB 2.02 kB +1.42% 0.85 kB 0.86 kB
oss-stable/scheduler/cjs/scheduler-unstable_post_task.production.min.js +2.59% 1.97 kB 2.02 kB +1.42% 0.85 kB 0.86 kB
oss-experimental/scheduler/cjs/scheduler-unstable_post_task.development.js +2.28% 6.88 kB 7.04 kB +1.82% 2.08 kB 2.12 kB
oss-stable-semver/scheduler/cjs/scheduler-unstable_post_task.development.js +2.28% 6.88 kB 7.04 kB +1.82% 2.08 kB 2.12 kB
oss-stable/scheduler/cjs/scheduler-unstable_post_task.development.js +2.28% 6.88 kB 7.04 kB +1.82% 2.08 kB 2.12 kB
facebook-www/SchedulerPostTask-dev.classic.js +2.24% 7.01 kB 7.17 kB +1.71% 2.11 kB 2.14 kB
facebook-www/SchedulerPostTask-dev.modern.js +2.24% 7.01 kB 7.17 kB +1.71% 2.11 kB 2.14 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/umd/scheduler.production.min.js +5.20% 4.63 kB 4.88 kB +1.73% 0.87 kB 0.88 kB
oss-experimental/scheduler/umd/scheduler.profiling.min.js +5.20% 4.63 kB 4.88 kB +1.73% 0.87 kB 0.88 kB
oss-stable-semver/scheduler/umd/scheduler.production.min.js +5.20% 4.63 kB 4.88 kB +1.73% 0.87 kB 0.88 kB
oss-stable-semver/scheduler/umd/scheduler.profiling.min.js +5.20% 4.63 kB 4.88 kB +1.73% 0.87 kB 0.88 kB
oss-stable/scheduler/umd/scheduler.production.min.js +5.20% 4.63 kB 4.88 kB +1.73% 0.87 kB 0.88 kB
oss-stable/scheduler/umd/scheduler.profiling.min.js +5.20% 4.63 kB 4.88 kB +1.73% 0.87 kB 0.88 kB
oss-experimental/scheduler/umd/scheduler.development.js +4.92% 4.90 kB 5.14 kB +1.61% 0.87 kB 0.88 kB
oss-stable-semver/scheduler/umd/scheduler.development.js +4.92% 4.90 kB 5.14 kB +1.61% 0.87 kB 0.88 kB
oss-stable/scheduler/umd/scheduler.development.js +4.92% 4.90 kB 5.14 kB +1.61% 0.87 kB 0.88 kB
oss-experimental/scheduler/cjs/scheduler-unstable_post_task.production.min.js +2.59% 1.97 kB 2.02 kB +1.42% 0.85 kB 0.86 kB
oss-stable-semver/scheduler/cjs/scheduler-unstable_post_task.production.min.js +2.59% 1.97 kB 2.02 kB +1.42% 0.85 kB 0.86 kB
oss-stable/scheduler/cjs/scheduler-unstable_post_task.production.min.js +2.59% 1.97 kB 2.02 kB +1.42% 0.85 kB 0.86 kB
oss-experimental/scheduler/cjs/scheduler-unstable_post_task.development.js +2.28% 6.88 kB 7.04 kB +1.82% 2.08 kB 2.12 kB
oss-stable-semver/scheduler/cjs/scheduler-unstable_post_task.development.js +2.28% 6.88 kB 7.04 kB +1.82% 2.08 kB 2.12 kB
oss-stable/scheduler/cjs/scheduler-unstable_post_task.development.js +2.28% 6.88 kB 7.04 kB +1.82% 2.08 kB 2.12 kB
facebook-www/SchedulerPostTask-dev.classic.js +2.24% 7.01 kB 7.17 kB +1.71% 2.11 kB 2.14 kB
facebook-www/SchedulerPostTask-dev.modern.js +2.24% 7.01 kB 7.17 kB +1.71% 2.11 kB 2.14 kB
facebook-www/SchedulerPostTask-prod.classic.js +1.69% 4.07 kB 4.14 kB +1.25% 1.12 kB 1.14 kB
facebook-www/SchedulerPostTask-prod.modern.js +1.69% 4.07 kB 4.14 kB +1.25% 1.12 kB 1.14 kB
facebook-www/SchedulerPostTask-profiling.classic.js +1.69% 4.07 kB 4.14 kB +1.25% 1.12 kB 1.14 kB
facebook-www/SchedulerPostTask-profiling.modern.js +1.69% 4.07 kB 4.14 kB +1.25% 1.12 kB 1.14 kB
oss-experimental/scheduler/cjs/scheduler.production.min.js +1.20% 4.24 kB 4.29 kB +0.67% 1.78 kB 1.79 kB
oss-stable-semver/scheduler/cjs/scheduler.production.min.js +1.20% 4.24 kB 4.29 kB +0.67% 1.78 kB 1.79 kB
oss-stable/scheduler/cjs/scheduler.production.min.js +1.20% 4.24 kB 4.29 kB +0.67% 1.78 kB 1.79 kB
oss-experimental/scheduler/cjs/scheduler-unstable_mock.production.min.js +1.02% 4.79 kB 4.84 kB +0.47% 1.94 kB 1.94 kB
oss-stable-semver/scheduler/cjs/scheduler-unstable_mock.production.min.js +1.02% 4.79 kB 4.84 kB +0.47% 1.94 kB 1.94 kB
oss-stable/scheduler/cjs/scheduler-unstable_mock.production.min.js +1.02% 4.79 kB 4.84 kB +0.47% 1.94 kB 1.94 kB
oss-experimental/scheduler/cjs/scheduler-unstable_mock.development.js +0.93% 17.46 kB 17.62 kB +0.93% 4.20 kB 4.23 kB
oss-stable-semver/scheduler/cjs/scheduler-unstable_mock.development.js +0.93% 17.46 kB 17.62 kB +0.93% 4.20 kB 4.23 kB
oss-stable/scheduler/cjs/scheduler-unstable_mock.development.js +0.93% 17.46 kB 17.62 kB +0.93% 4.20 kB 4.23 kB
facebook-react-native/scheduler/cjs/SchedulerMock-dev.js +0.93% 17.51 kB 17.67 kB +0.91% 4.20 kB 4.23 kB
oss-experimental/scheduler/umd/scheduler-unstable_mock.development.js +0.92% 18.78 kB 18.95 kB +0.93% 4.31 kB 4.35 kB
oss-stable-semver/scheduler/umd/scheduler-unstable_mock.development.js +0.92% 18.78 kB 18.95 kB +0.93% 4.31 kB 4.35 kB
oss-stable/scheduler/umd/scheduler-unstable_mock.development.js +0.92% 18.78 kB 18.95 kB +0.93% 4.31 kB 4.35 kB
oss-experimental/scheduler/umd/scheduler-unstable_mock.production.min.js +0.89% 4.83 kB 4.87 kB +0.54% 2.04 kB 2.05 kB
oss-stable-semver/scheduler/umd/scheduler-unstable_mock.production.min.js +0.89% 4.83 kB 4.87 kB +0.54% 2.04 kB 2.05 kB
oss-stable/scheduler/umd/scheduler-unstable_mock.production.min.js +0.89% 4.83 kB 4.87 kB +0.54% 2.04 kB 2.05 kB
facebook-react-native/scheduler/cjs/SchedulerMock-prod.js +0.75% 11.87 kB 11.96 kB +0.39% 2.80 kB 2.81 kB
facebook-www/SchedulerMock-prod.classic.js +0.73% 12.14 kB 12.23 kB +0.35% 2.88 kB 2.89 kB
facebook-www/SchedulerMock-prod.modern.js +0.73% 12.14 kB 12.23 kB +0.35% 2.88 kB 2.89 kB
facebook-www/SchedulerMock-dev.classic.js +0.71% 22.70 kB 22.87 kB +0.74% 5.37 kB 5.41 kB
facebook-www/SchedulerMock-dev.modern.js +0.71% 22.70 kB 22.87 kB +0.74% 5.37 kB 5.41 kB
facebook-react-native/scheduler/cjs/Scheduler-prod.js +0.68% 10.27 kB 10.34 kB +0.54% 2.60 kB 2.61 kB
facebook-react-native/scheduler/cjs/Scheduler-profiling.js +0.64% 10.88 kB 10.95 kB +0.51% 2.74 kB 2.75 kB
facebook-www/Scheduler-prod.classic.js +0.60% 11.58 kB 11.65 kB +0.28% 2.88 kB 2.89 kB
facebook-www/Scheduler-prod.modern.js +0.60% 11.58 kB 11.65 kB +0.28% 2.88 kB 2.89 kB
oss-experimental/scheduler/cjs/scheduler.development.js +0.51% 17.50 kB 17.59 kB +0.69% 4.93 kB 4.96 kB
oss-stable-semver/scheduler/cjs/scheduler.development.js +0.51% 17.50 kB 17.59 kB +0.69% 4.93 kB 4.96 kB
oss-stable/scheduler/cjs/scheduler.development.js +0.51% 17.50 kB 17.59 kB +0.69% 4.93 kB 4.96 kB
facebook-react-native/scheduler/cjs/Scheduler-dev.js +0.51% 17.52 kB 17.61 kB +0.73% 4.94 kB 4.97 kB
facebook-www/Scheduler-profiling.classic.js +0.44% 15.90 kB 15.97 kB +0.32% 3.71 kB 3.72 kB
facebook-www/Scheduler-profiling.modern.js +0.44% 15.90 kB 15.97 kB +0.32% 3.71 kB 3.72 kB
oss-stable-semver/react/umd/react.profiling.min.js +0.40% 10.74 kB 10.78 kB +0.31% 4.25 kB 4.27 kB
oss-stable-semver/react/umd/react.production.min.js +0.40% 10.74 kB 10.78 kB +0.28% 4.26 kB 4.27 kB
oss-stable/react/umd/react.profiling.min.js +0.40% 10.76 kB 10.80 kB +0.30% 4.28 kB 4.29 kB
oss-stable/react/umd/react.production.min.js +0.40% 10.76 kB 10.80 kB +0.30% 4.28 kB 4.29 kB
oss-experimental/react/umd/react.profiling.min.js +0.37% 11.76 kB 11.80 kB +0.40% 4.55 kB 4.57 kB
oss-experimental/react/umd/react.production.min.js +0.37% 11.76 kB 11.80 kB +0.40% 4.55 kB 4.57 kB
facebook-www/Scheduler-dev.classic.js +0.36% 24.67 kB 24.76 kB +0.50% 6.62 kB 6.66 kB
facebook-www/Scheduler-dev.modern.js +0.36% 24.67 kB 24.76 kB +0.50% 6.62 kB 6.66 kB

Generated by 🚫 dangerJS against 5a73703

@acdlite acdlite merged commit ca990e9 into facebook:main Aug 5, 2022
facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Sep 12, 2022
Summary:
This sync includes the following changes:
- **[c28f313e6](facebook/react@c28f313e6 )**: experimental_use(promise) for SSR ([#25214](facebook/react#25214)) //<Andrew Clark>//
- **[d6f9628a8](facebook/react@d6f9628a8 )**: Remove some RSC subset entry points that were removed in the main entry point ([#25209](facebook/react#25209)) //<Sebastian Markbåge>//
- **[a473d08fc](facebook/react@a473d08fc )**: Update to Flow from 0.97 to 0.122 ([#25204](facebook/react#25204)) //<Jan Kassens>//
- **[7028ce745](facebook/react@7028ce745 )**: experimental_use(promise) for Server Components ([#25207](facebook/react#25207)) //<Andrew Clark>//
- **[bfb65681e](facebook/react@bfb65681e )**: experimental_use(context)([#25202](facebook/react#25202)) //<mofeiZ>//
- **[f0efa1164](facebook/react@f0efa1164 )**: [flow] remove custom suppress comment config ([#25170](facebook/react#25170)) //<Jan Kassens>//
- **[2e7f422fe](facebook/react@2e7f422fe )**: Refactor: its type is Container ([#25153](facebook/react#25153)) //<bubucuo>//
- **[2c2d9a1df](facebook/react@2c2d9a1df )**: [eslint-plugin-react-hooks] only allow capitalized component names ([#25162](facebook/react#25162)) //<Jan Kassens>//
- **[36c908a6c](facebook/react@36c908a6c )**: Don't use the Flight terminology in public error messages ([#25166](facebook/react#25166)) //<Sebastian Markbåge>//
- **[8d1b057ec](facebook/react@8d1b057ec )**: [Flight] Minor error handling fixes ([#25151](facebook/react#25151)) //<Sebastian Markbåge>//
- **[9ff738f53](facebook/react@9ff738f53 )**: [devtools][easy] Fix flow type ([#25147](facebook/react#25147)) //<Tianyu Yao>//
- **[0de3ddf56](facebook/react@0de3ddf56 )**: Remove Symbol Polyfill (again) ([#25144](facebook/react#25144)) //<Ricky>//
- **[b36f72235](facebook/react@b36f72235 )**: Remove ReactFiberFlags MountLayoutDev and MountPassiveDev ([#25091](facebook/react#25091)) //<Samuel Susla>//
- **[b6978bc38](facebook/react@b6978bc38 )**: experimental_use(promise) ([#25084](facebook/react#25084)) //<Andrew Clark>//
- **[11ed7010c](facebook/react@11ed7010c )**: [Transition Tracing] onMarkerIncomplete - Tracing Marker/Suspense Boundary Deletions ([#24885](facebook/react#24885)) //<Luna Ruan>//
- **[b79894259](facebook/react@b79894259 )**: [Flight] Add support for Webpack Async Modules ([#25138](facebook/react#25138)) //<Sebastian Markbåge>//
- **[c8b778b7f](facebook/react@c8b778b7f )**: Fix typo: supportsMicrotask -> supportsMicrotasks ([#25142](facebook/react#25142)) //<kwzr>//
- **[d0f396651](facebook/react@d0f396651 )**: Allow functions to be used as module references ([#25137](facebook/react#25137)) //<Sebastian Markbåge>//
- **[38c5d8a03](facebook/react@38c5d8a03 )**: Test the node-register hooks in unit tests ([#25132](facebook/react#25132)) //<Sebastian Markbåge>//
- **[3f70e68ce](facebook/react@3f70e68ce )**: Return closestInstance in `getInspectorDataForViewAtPoint` ([#25118](facebook/react#25118)) //<Tianyu Yao>//
- **[3d443cad7](facebook/react@3d443cad7 )**: Update fixtures/flight to webpack 5 ([#25115](facebook/react#25115)) //<Tim Neutkens>//
- **[5d1ce6513](facebook/react@5d1ce6513 )**: Align StrictMode behaviour with production ([#25049](facebook/react#25049)) //<Samuel Susla>//
- **[9e67e7a31](facebook/react@9e67e7a31 )**: Scaffolding for useMemoCache hook ([#25123](facebook/react#25123)) //<Joseph Savona>//
- **[19e9a4c68](facebook/react@19e9a4c68 )**: Add missing createServerContext for experimental shared subset ([#25114](facebook/react#25114)) //<Jiachi Liu>//
- **[6ef466c68](facebook/react@6ef466c68 )**: make preamble and postamble types explicit and fix typo ([#25102](facebook/react#25102)) //<Josh Story>//
- **[796d31809](facebook/react@796d31809 )**: Implement basic stylesheet Resources for react-dom ([#25060](facebook/react#25060)) //<Josh Story>//
- **[32baab38f](facebook/react@32baab38f )**: [Transition Tracing] Add Tag Field to Marker Instance ([#25085](facebook/react#25085)) //<Luna Ruan>//
- **[8ef3a7c08](facebook/react@8ef3a7c08 )**: Resume immediately pinged fiber without unwinding ([#25074](facebook/react#25074)) //<Andrew Clark>//
- **[7bcc68772](facebook/react@7bcc68772 )**: Remove argument committedLanes from reappearLayoutEffects and recursivelyTraverseReappearLayoutEffects ([#25080](facebook/react#25080)) //<Samuel Susla>//
- **[ca990e9a7](facebook/react@ca990e9a7 )**: Add API to force Scheduler to yield for macrotask ([#25044](facebook/react#25044)) //<Andrew Clark>//
- **[b4204ede6](facebook/react@b4204ede6 )**: Clean up unused Deletion flag ([#24992](facebook/react#24992)) //<Andrew Clark>//
- **[e193be87e](facebook/react@e193be87e )**: [Transition Tracing] Add Offscreen Test ([#25035](facebook/react#25035)) //<Luna Ruan>//
- **[9fcaf88d5](facebook/react@9fcaf88d5 )**: Remove rootContainerInstance from unnecessary places ([#25024](facebook/react#25024)) //<Sebastian Markbåge>//
- **[80f3d8819](facebook/react@80f3d8819 )**: Mount/unmount passive effects when Offscreen visibility changes ([#24977](facebook/react#24977)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions 4ea064e...c28f313

Reviewed By: rickhanlonii

Differential Revision: D39384898

fbshipit-source-id: 20b080a53851d6dd9d522c8468dd02aab9ba76db
rickhanlonii pushed a commit that referenced this pull request Oct 6, 2022
We need a way to yield control of the main thread and schedule a
continuation in a separate macrotask. (This is related to some Suspense
optimizations we have planned.)

Our solution needs account for how Scheduler is implemented. Scheduler
tasks are not 1:1 with real browser macrotasks — many Scheduler "tasks"
can be executed within a single browser task. If a Scheduler task yields
control and posts a continuation, but there's still time left in the
frame, Scheduler will execute the continuation immediately
(synchronously) without yielding control back to the main thread. That's
not what we want — we want to schedule a new macrotask regardless of
where we are in the browser's render cycle.

There are several ways we could approach this. What I ended up doing was
adding a new Scheduler method `unstable_requestYield`. (It's similar to
the existing `unstable_requestPaint` that we use to yield at the end of
the frame.)

It works by setting the internal start time of the current work loop to
a large negative number, so that when the `shouldYield` call computes
how much time has elapsed, it's guaranteed to exceed the deadline. The
advantage of doing it this way is that there are no additional checks in
the normal hot path of the work loop.

The existing layering between Scheduler and React DOM is not ideal. None
of the APIs are public, so despite the fact that Scheduler is a separate
package, I consider that a private implementation detail, and think of
them as part of the same unit.

So for now, though, I think it makes sense to implement this macrotask
logic directly inside of Scheduler instead of layering it on top.

The rough eventual plan for Scheduler is turn it into a `postTask`
prollyfill. Because `postTask` does not yet have an equivalent for
`shouldYield`, we would split that out into its own layer, perhaps
directly inside the reconciler. In that world, the macrotask logic I've
added in this commit would likely live in that same layer. When the
native `postTask` is available, we may not even need any additional
logic because it uses actual browser tasks.
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
Summary:
This sync includes the following changes:
- **[c28f313e6](facebook/react@c28f313e6 )**: experimental_use(promise) for SSR ([facebook#25214](facebook/react#25214)) //<Andrew Clark>//
- **[d6f9628a8](facebook/react@d6f9628a8 )**: Remove some RSC subset entry points that were removed in the main entry point ([facebook#25209](facebook/react#25209)) //<Sebastian Markbåge>//
- **[a473d08fc](facebook/react@a473d08fc )**: Update to Flow from 0.97 to 0.122 ([facebook#25204](facebook/react#25204)) //<Jan Kassens>//
- **[7028ce745](facebook/react@7028ce745 )**: experimental_use(promise) for Server Components ([facebook#25207](facebook/react#25207)) //<Andrew Clark>//
- **[bfb65681e](facebook/react@bfb65681e )**: experimental_use(context)([facebook#25202](facebook/react#25202)) //<mofeiZ>//
- **[f0efa1164](facebook/react@f0efa1164 )**: [flow] remove custom suppress comment config ([facebook#25170](facebook/react#25170)) //<Jan Kassens>//
- **[2e7f422fe](facebook/react@2e7f422fe )**: Refactor: its type is Container ([facebook#25153](facebook/react#25153)) //<bubucuo>//
- **[2c2d9a1df](facebook/react@2c2d9a1df )**: [eslint-plugin-react-hooks] only allow capitalized component names ([facebook#25162](facebook/react#25162)) //<Jan Kassens>//
- **[36c908a6c](facebook/react@36c908a6c )**: Don't use the Flight terminology in public error messages ([facebook#25166](facebook/react#25166)) //<Sebastian Markbåge>//
- **[8d1b057ec](facebook/react@8d1b057ec )**: [Flight] Minor error handling fixes ([facebook#25151](facebook/react#25151)) //<Sebastian Markbåge>//
- **[9ff738f53](facebook/react@9ff738f53 )**: [devtools][easy] Fix flow type ([facebook#25147](facebook/react#25147)) //<Tianyu Yao>//
- **[0de3ddf56](facebook/react@0de3ddf56 )**: Remove Symbol Polyfill (again) ([facebook#25144](facebook/react#25144)) //<Ricky>//
- **[b36f72235](facebook/react@b36f72235 )**: Remove ReactFiberFlags MountLayoutDev and MountPassiveDev ([facebook#25091](facebook/react#25091)) //<Samuel Susla>//
- **[b6978bc38](facebook/react@b6978bc38 )**: experimental_use(promise) ([facebook#25084](facebook/react#25084)) //<Andrew Clark>//
- **[11ed7010c](facebook/react@11ed7010c )**: [Transition Tracing] onMarkerIncomplete - Tracing Marker/Suspense Boundary Deletions ([facebook#24885](facebook/react#24885)) //<Luna Ruan>//
- **[b79894259](facebook/react@b79894259 )**: [Flight] Add support for Webpack Async Modules ([facebook#25138](facebook/react#25138)) //<Sebastian Markbåge>//
- **[c8b778b7f](facebook/react@c8b778b7f )**: Fix typo: supportsMicrotask -> supportsMicrotasks ([facebook#25142](facebook/react#25142)) //<kwzr>//
- **[d0f396651](facebook/react@d0f396651 )**: Allow functions to be used as module references ([facebook#25137](facebook/react#25137)) //<Sebastian Markbåge>//
- **[38c5d8a03](facebook/react@38c5d8a03 )**: Test the node-register hooks in unit tests ([facebook#25132](facebook/react#25132)) //<Sebastian Markbåge>//
- **[3f70e68ce](facebook/react@3f70e68ce )**: Return closestInstance in `getInspectorDataForViewAtPoint` ([facebook#25118](facebook/react#25118)) //<Tianyu Yao>//
- **[3d443cad7](facebook/react@3d443cad7 )**: Update fixtures/flight to webpack 5 ([facebook#25115](facebook/react#25115)) //<Tim Neutkens>//
- **[5d1ce6513](facebook/react@5d1ce6513 )**: Align StrictMode behaviour with production ([facebook#25049](facebook/react#25049)) //<Samuel Susla>//
- **[9e67e7a31](facebook/react@9e67e7a31 )**: Scaffolding for useMemoCache hook ([facebook#25123](facebook/react#25123)) //<Joseph Savona>//
- **[19e9a4c68](facebook/react@19e9a4c68 )**: Add missing createServerContext for experimental shared subset ([facebook#25114](facebook/react#25114)) //<Jiachi Liu>//
- **[6ef466c68](facebook/react@6ef466c68 )**: make preamble and postamble types explicit and fix typo ([facebook#25102](facebook/react#25102)) //<Josh Story>//
- **[796d31809](facebook/react@796d31809 )**: Implement basic stylesheet Resources for react-dom ([facebook#25060](facebook/react#25060)) //<Josh Story>//
- **[32baab38f](facebook/react@32baab38f )**: [Transition Tracing] Add Tag Field to Marker Instance ([facebook#25085](facebook/react#25085)) //<Luna Ruan>//
- **[8ef3a7c08](facebook/react@8ef3a7c08 )**: Resume immediately pinged fiber without unwinding ([facebook#25074](facebook/react#25074)) //<Andrew Clark>//
- **[7bcc68772](facebook/react@7bcc68772 )**: Remove argument committedLanes from reappearLayoutEffects and recursivelyTraverseReappearLayoutEffects ([facebook#25080](facebook/react#25080)) //<Samuel Susla>//
- **[ca990e9a7](facebook/react@ca990e9a7 )**: Add API to force Scheduler to yield for macrotask ([facebook#25044](facebook/react#25044)) //<Andrew Clark>//
- **[b4204ede6](facebook/react@b4204ede6 )**: Clean up unused Deletion flag ([facebook#24992](facebook/react#24992)) //<Andrew Clark>//
- **[e193be87e](facebook/react@e193be87e )**: [Transition Tracing] Add Offscreen Test ([facebook#25035](facebook/react#25035)) //<Luna Ruan>//
- **[9fcaf88d5](facebook/react@9fcaf88d5 )**: Remove rootContainerInstance from unnecessary places ([facebook#25024](facebook/react#25024)) //<Sebastian Markbåge>//
- **[80f3d8819](facebook/react@80f3d8819 )**: Mount/unmount passive effects when Offscreen visibility changes ([facebook#24977](facebook/react#24977)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions 4ea064e...c28f313

Reviewed By: rickhanlonii

Differential Revision: D39384898

fbshipit-source-id: 20b080a53851d6dd9d522c8468dd02aab9ba76db
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.

4 participants