GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Make time-slicing opt-in by rickhanlonii · Pull Request #21072 · react/react

Conversation

@rickhanlonii

@rickhanlonii rickhanlonii commented Mar 24, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Overview

This PR adds a new flag to synchronously flush updates in a task by default.

This has the practical effect of making time-slicing optional in the next major version.

Motivation

As we've iterated on concurrent features like Suspense and startTransition, we've seen the benefits of Time-slicing not only in those APIs, but also for time-slicing updates by default as shown in the talk above. Time slicing allows React to yield to other work while rendering and allow higher priority tasks such as user interactions, network events, or other renders to be processed. Based on this research, time-slicing by default is the future of React.

However, time-slicing can cause issues with existing code that was not written with yielding in mind. For example, by yielding to other work, we allow for the possibility that external sources of information read during render are updated. This can cause tearing - where part of the UI displays an old value and another part shows a new value. This isn't a React specific bug - it's the logical consequence of concurrency.

We've introduced warnings and dev-behavior to StrictMode to help users catch these types of issues, however there is still a large part of the community that is not ready for the new behavior by default. If we were to keep time-slicing on by default for all updates, then most users would need to convert their entire app to support concurrency all at once before upgrading to the next major version of React.

Changes

This PR updates the default behavior of React in the next major version to flush updates synchronously in a task, similar to how the current behavior works. This means users will not use time-slicing by default when upgrading to the concurrent root, and their app will continue to synchronously render (almost) the same as before.

To opt-in to time-slicing, users can incrementally adopt concurrent features such are Suspense (which will concurrently re-try rendering with time-slicing) or startTransition (which will render updates concurrently with time-slicing). This strategy allows users to begin to use concurrent features in subtrees of their app, while working to adopt StrictMode globally and prepare for the future of React with time-slicing by default.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

uptonking, gaearon, malcolm-kee, cassiozen, Dean177, timoxley, cp, davidkpiano, zoontek, dubzzz, and preshonyee reacted with thumbs up emoji NE-SmallTown, taneliang, brainkim, and physicshi reacted with eyes emoji
All reactions
  • 👍 11 reactions
  • 👀 4 reactions
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Mar 24, 2021
@rickhanlonii
rickhanlonii force-pushed the rh-default-sync branch from 83bc528 to cc1bb38 Compare March 24, 2021 13:54
@sizebot

sizebot commented Mar 24, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Comparing: 8a4a59c...7e9bb7b

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 +0.11% 122.55 kB 122.69 kB +0.11% 39.34 kB 39.39 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js +0.10% 129.12 kB 129.25 kB +0.11% 41.43 kB 41.47 kB
facebook-www/ReactDOM-prod.classic.js +0.13% 411.67 kB 412.22 kB +0.10% 76.17 kB 76.25 kB
facebook-www/ReactDOM-prod.modern.js +0.14% 399.73 kB 400.27 kB +0.11% 74.26 kB 74.34 kB
facebook-www/ReactDOMForked-prod.classic.js +0.13% 411.67 kB 412.22 kB +0.10% 76.18 kB 76.25 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
facebook-www/ReactIs-dev.classic.js +0.75% 9.99 kB 10.07 kB +0.41% 2.71 kB 2.72 kB
facebook-www/ReactIs-dev.modern.js +0.73% 10.26 kB 10.33 kB +0.40% 2.76 kB 2.77 kB
facebook-www/SchedulerTracing-dev.modern.js +0.66% 11.28 kB 11.36 kB +0.48% 2.49 kB 2.50 kB
facebook-www/SchedulerTracing-dev.classic.js +0.66% 11.29 kB 11.36 kB +0.48% 2.49 kB 2.50 kB

Generated by 🚫 dangerJS against 7e9bb7b

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

acdlite
acdlite reviewed Mar 24, 2021
View reviewed changes
Comment thread packages/react-reconciler/src/ReactFiberLane.old.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

acdlite
acdlite reviewed Mar 24, 2021
View reviewed changes
Comment thread packages/react-reconciler/src/ReactFiberWorkLoop.new.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

acdlite
acdlite reviewed Mar 24, 2021
View reviewed changes
Comment thread packages/shared/ReactFeatureFlags.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@rickhanlonii rickhanlonii self-assigned this Mar 24, 2021
@rickhanlonii
rickhanlonii force-pushed the rh-default-sync branch from cc1bb38 to 1cddd39 Compare March 24, 2021 19:19
acdlite
acdlite reviewed Mar 24, 2021
View reviewed changes
Comment thread packages/shared/forks/ReactFeatureFlags.www.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

acdlite
acdlite reviewed Mar 24, 2021
View reviewed changes
Comment thread packages/shared/forks/ReactFeatureFlags.native-oss.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@rickhanlonii
rickhanlonii force-pushed the rh-default-sync branch 8 times, most recently from 405a9af to 73cde84 Compare April 6, 2021 19:52
@rickhanlonii

rickhanlonii commented Apr 6, 2021

Copy link
Copy Markdown
Contributor Author

done

gaearon, tjallingt, Pilaba, jsjoeio, likern, DanielFGray, NE-SmallTown, cp, HoikanChan, janzell, and 3 more reacted with laugh emoji DanielFGray, cp, themre, danieljpgo, and HoikanChan reacted with hooray emoji
All reactions
  • 😄 13 reactions
  • 🎉 5 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rickhanlonii rickhanlonii changed the title [WIP] Add enableSyncDefaultUpdates Flush default updates synchronously in a task Apr 6, 2021
@rickhanlonii
rickhanlonii marked this pull request as ready for review April 6, 2021 20:50
@rickhanlonii rickhanlonii changed the title Flush default updates synchronously in a task Flush updates synchronously by default Apr 6, 2021
@rickhanlonii rickhanlonii changed the title Flush updates synchronously by default Make time-slicing opt-in Apr 6, 2021
acdlite
acdlite reviewed Apr 7, 2021
View reviewed changes
Comment thread packages/react-reconciler/src/ReactFiberWorkLoop.new.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

acdlite
acdlite reviewed Apr 7, 2021
View reviewed changes
Comment thread packages/react-reconciler/src/ReactFiberWorkLoop.new.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@gaearon gaearon mentioned this pull request Apr 7, 2021
[Umbrella] Releasing Suspense #13206
Open
44 of 63 tasks
rickhanlonii added 3 commits April 9, 2021 17:05
@rickhanlonii
Add enableSyncDefaultUpdates feature flag
5dc1086
@rickhanlonii
Add enableSyncDefaultUpdates implementation
d610dd0
@rickhanlonii
Fix tests
ff0025e
rickhanlonii added 5 commits April 9, 2021 17:09
@rickhanlonii
Switch feature flag to true by default
0f845aa
@rickhanlonii
Finish concurrent render whenever for non-sync lanes
fcb189c
@rickhanlonii
Also return DefaultLane with eventLane
4c107d8
@rickhanlonii
Gate interruption test
b5aec1f
@rickhanlonii
Add continuout native event test
c0e31a5
@rickhanlonii
rickhanlonii force-pushed the rh-default-sync branch from 076b228 to c0e31a5 Compare April 9, 2021 21:10
@rickhanlonii
Fix tests from rebasing main
0a90a3e
@rickhanlonii
rickhanlonii requested a review from acdlite April 9, 2021 21:45
acdlite
acdlite reviewed Apr 9, 2021
View reviewed changes
Comment thread packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js
});
if (gate(flags => flags.enableSyncDefaultUpdates)) {
React.unstable_startTransition(() => {
// TODO: Batched updates need to be inside startTransition?

@acdlite acdlite Apr 9, 2021

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

What's going on here? Seems like a bug

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@rickhanlonii rickhanlonii Apr 9, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

We're not taking the executionContext into account when scheduling the sync updates, so the updates inside of batchedUpdates are each flushed synchronously

This would fix it in ensureRootIsScheduled, but I don't know enough about batchedUpdates or executionContext to know if this is the desired behavior/fix:

Screen Shot 2021-04-09 at 7 10 58 PM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@rickhanlonii rickhanlonii Apr 9, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Let's follow up with this, I want to merge so that I don't get another merge conflict since this is so big.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@acdlite acdlite Apr 10, 2021

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Nvm, I think this is fine. batchedUpdates doesn't change the priority, so it makes sense you need to wrap these with startTransition when the sync-by-default flag is on.

I had misinterpreted the TODO as saying that without startTransition, the updates wouldn't be batched.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
acdlite
acdlite reviewed Apr 9, 2021
View reviewed changes
Comment thread packages/react-reconciler/src/__tests__/SchedulingProfiler-test.internal.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

acdlite
acdlite reviewed Apr 9, 2021
View reviewed changes
Comment thread packages/react-reconciler/src/__tests__/SchedulingProfilerLabels-test.internal.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

acdlite
acdlite reviewed Apr 9, 2021
View reviewed changes
Comment thread packages/react-reconciler/src/ReactFiberLane.old.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

acdlite
acdlite approved these changes Apr 9, 2021
View reviewed changes

@acdlite acdlite left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Yay!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
rickhanlonii added 2 commits April 9, 2021 19:22
@rickhanlonii
Hardcode lanes, remove added export
155d0b4
@rickhanlonii
Sync forks
7e9bb7b
@rickhanlonii
rickhanlonii merged commit 933880b into react:master Apr 9, 2021
@rickhanlonii
rickhanlonii deleted the rh-default-sync branch April 9, 2021 23:50
duuliy added a commit to duuliy/react that referenced this pull request Apr 12, 2021
@duuliy
Revert "Make time-slicing opt-in (react#21072)"
b8a5408
This reverts commit 933880b.
facebook-github-bot pushed a commit to react/react-native that referenced this pull request Apr 20, 2021
Andrei Shikov @facebook-github-bot
React Native sync for revisions c9aab1c...f7cdc89
de318cd
Summary:
This sync includes the following changes:
- **[f7cdc89](react/react@f7cdc8936 )**: Also turn off enableSyncDefaultUpdates in RN test renderer ([#21293](react/react#21293)) //<Ricky>//
- **[4c9eb2a](react/react@4c9eb2af1 )**: Add dynamic flags to React Native ([#21291](react/react#21291)) //<Ricky>//
- **[9eddfbf](react/react@9eddfbf5a )**: [Fizz] Two More Fixes ([#21288](react/react#21288)) //<Sebastian Markbåge>//
- **[11b0759](react/react@11b07597e )**: Fix classes ([#21283](react/react#21283)) //<Sebastian Markbåge>//
- **[96d00b9](react/react@96d00b9bb )**: [Fizz] Random Fixes ([#21277](react/react#21277)) //<Sebastian Markbåge>//
- **[81ef539](react/react@81ef53953 )**: Always insert a dummy node with an ID into fallbacks ([#21272](react/react#21272)) //<Sebastian Markbåge>//
- **[a4a940d](react/react@a4a940d7a )**: [Fizz] Add unsupported Portal/Scope components ([#21261](react/react#21261)) //<Sebastian Markbåge>//
- **[f4d7a0f](react/react@f4d7a0f1e )**: Implement useOpaqueIdentifier ([#21260](react/react#21260)) //<Sebastian Markbåge>//
- **[dde875d](react/react@dde875dfb )**: [Fizz] Implement Hooks ([#21257](react/react#21257)) //<Sebastian Markbåge>//
- **[a597c2f](react/react@a597c2f5d )**: [Fizz] Fix reentrancy bug ([#21270](react/react#21270)) //<Sebastian Markbåge>//
- **[15e779d](react/react@15e779d92 )**: Reconciler should inject its own version into DevTools hook ([#21268](react/react#21268)) //<Brian Vaughn>//
- **[4f76a28](react/react@4f76a28c9 )**: [Fizz] Implement New Context ([#21255](react/react#21255)) //<Sebastian Markbåge>//
- **[82ef450](react/react@82ef450e0 )**: remove obsolete SharedArrayBuffer ESLint config ([#21259](react/react#21259)) //<Henry Q. Dineen>//
- **[dbadfa2](react/react@dbadfa2c3 )**: [Fizz] Classes Follow Up ([#21253](react/react#21253)) //<Sebastian Markbåge>//
- **[686b635](react/react@686b635b7 )**: Prevent reading canonical property of null ([#21242](react/react#21242)) //<Joshua Gross>//
- **[bb88ce9](react/react@bb88ce95a )**: Bugfix: Don't rely on `finishedLanes` for passive effects ([#21233](react/react#21233)) //<Andrew Clark>//
- **[343710c](react/react@343710c92 )**: [Fizz] Fragments and Iterable support ([#21228](react/react#21228)) //<Sebastian Markbåge>//
- **[933880b](react/react@933880b45 )**: Make time-slicing opt-in ([#21072](react/react#21072)) //<Ricky>//
- **[b0407b5](react/react@b0407b55f )**: Support more empty types ([#21225](react/react#21225)) //<Sebastian Markbåge>//
- **[3971371](react/react@39713716a )**: Merge isObject branches ([#21226](react/react#21226)) //<Sebastian Markbåge>//
- **[8a4a59c](react/react@8a4a59c72 )**: Remove textarea special case from child fiber ([#21222](react/react#21222)) //<Sebastian Markbåge>//
- **[dc108b0](react/react@dc108b0f5 )**: Track which fibers scheduled the current render work ([#15658](react/react#15658)) //<Brian Vaughn>//
- **[6ea7491](react/react@6ea749170 )**: Fix typo in comment ([#21214](react/react#21214)) //<inokawa>//
- **[b38ac13](react/react@b38ac13f9 )**: DevTools: Add post-commit hook ([#21183](react/react#21183)) //<Brian Vaughn>//
- **[b943aeb](react/react@b943aeba8 )**: Fix: Passive effect updates are never sync ([#21215](react/react#21215)) //<Andrew Clark>//
- **[d389c54](react/react@d389c54d1 )**: Offscreen: Use JS stack to track hidden/unhidden subtree state ([#21211](react/react#21211)) //<Brian Vaughn>//
- **[c486dc1](react/react@c486dc1a4 )**: Remove unnecessary processUpdateQueue ([#21199](react/react#21199)) //<Sebastian Markbåge>//
- **[cf45a62](react/react@cf45a623a )**: [Fizz] Implement Classes ([#21200](react/react#21200)) //<Sebastian Markbåge>//
- **[75c6165](react/react@75c616554 )**: Include actual type of `Profiler#id` on type mismatch ([#20306](react/react#20306)) //<Sebastian Silbermann>//
- **[1214b30](react/react@1214b302e )**: test: Fix "couldn't locate all inline snapshots" ([#21205](react/react#21205)) //<Sebastian Silbermann>//
- **[1a02d27](react/react@1a02d2792 )**: style: delete unused isHost check ([#21203](react/react#21203)) //<wangao>//
- **[782f689](react/react@782f689ca )**: Don't double invoke getDerivedStateFromProps for module pattern ([#21193](react/react#21193)) //<Sebastian Markbåge>//
- **[e90c76a](react/react@e90c76a65 )**: Revert "Offscreen: Use JS stack to track hidden/unhidden subtree state" ([#21194](react/react#21194)) //<Brian Vaughn>//
- **[1f8583d](react/react@1f8583de8 )**: Offscreen: Use JS stack to track hidden/unhidden subtree state ([#21192](react/react#21192)) //<Brian Vaughn>//
- **[ad6e6ec](react/react@ad6e6ec7b )**: [Fizz] Prepare Recursive Loop for More Types ([#21186](react/react#21186)) //<Sebastian Markbåge>//
- **[172e89b](react/react@172e89b4b )**: Reland Remove redundant initial of isArray ([#21188](react/react#21188)) //<Sebastian Markbåge>//
- **[7c1ba2b](react/react@7c1ba2b57 )**: Proposed new Suspense layout effect semantics ([#21079](react/react#21079)) //<Brian Vaughn>//
- **[316aa36](react/react@316aa3686 )**: [Scheduler] Fix de-opt caused by out-of-bounds access ([#21147](react/react#21147)) //<Andrey Marchenko>//
- **[b4f119c](react/react@b4f119cdf )**: Revert "Remove redundant initial of isArray ([#21163](react/react#21163))" //<Sebastian Markbage>//
- **[c031970](react/react@c03197063 )**: Revert "apply prettier ([#21165](react/react#21165))" //<Sebastian Markbage>//
- **[94fd121](react/react@94fd1214d )**: apply prettier ([#21165](react/react#21165)) //<Behnam Mohammadi>//
- **[b130a0f](react/react@b130a0f5c )**: Remove redundant initial of isArray ([#21163](react/react#21163)) //<Behnam Mohammadi>//
- **[2c9fef3](react/react@2c9fef32d )**: Remove redundant initial of hasOwnProperty ([#21134](react/react#21134)) //<Behnam Mohammadi>//
- **[1cf9978](react/react@1cf9978d8 )**: Don't pass internals to callbacks ([#21161](react/react#21161)) //<Sebastian Markbåge>//
- **[b9e4c10](react/react@b9e4c10e9 )**: [Fizz] Implement all the DOM attributes and special cases ([#21153](react/react#21153)) //<Sebastian Markbåge>//
- **[f8ef4ff](react/react@f8ef4ff57 )**: Flush discrete passive effects before paint ([#21150](react/react#21150)) //<Andrew Clark>//
- **[b48b38a](react/react@b48b38af6 )**: Support nesting of startTransition and flushSync (alt) ([#21149](react/react#21149)) //<Sebastian Markbåge>//

Changelog:
[General][Changed] - React Native sync for revisions c9aab1c...f7cdc89

jest_e2e[run_all_tests]

Reviewed By: rickhanlonii

Differential Revision: D27740113

fbshipit-source-id: 6e27204d78e3e16ed205170006cb97c0d6bfa957
@acdlite acdlite mentioned this pull request Apr 20, 2021
Use performConcurrentWorkOnRoot for "sync default" #21322
Merged
acdlite added a commit that referenced this pull request Apr 21, 2021
@acdlite
Use performConcurrentWorkOnRoot for "sync default" (#21322)
ef37d55
Instead of `performSyncWorkOnRoot`.

The conceptual model is that the only difference between sync default
updates (in React 18) and concurrent default updates (in a future major
release) is time slicing. All other behavior should be the same
(i.e. the stuff in `finishConcurrentRender`).

Given this, I think it makes more sense to model the implementation this
way, too. This exposed a quirk in the previous implementation where
non-sync work was sometimes mistaken for sync work and flushed too
early. In the new implementation, `performSyncWorkOnRoot` is only used
for truly synchronous renders (i.e. `SyncLane`), which should make these
mistakes less common.

Fixes most of the tests marked with TODOs from #21072.
koto pushed a commit to koto/react that referenced this pull request Jun 15, 2021
@rickhanlonii @koto
Make time-slicing opt-in (react#21072)
cd2b461
* Add enableSyncDefaultUpdates feature flag

* Add enableSyncDefaultUpdates implementation

* Fix tests

* Switch feature flag to true by default

* Finish concurrent render whenever for non-sync lanes

* Also return DefaultLane with eventLane

* Gate interruption test

* Add continuout native event test

* Fix tests from rebasing main

* Hardcode lanes, remove added export

* Sync forks
koto pushed a commit to koto/react that referenced this pull request Jun 15, 2021
@acdlite @koto
Use performConcurrentWorkOnRoot for "sync default" (react#21322)
826ce2f
Instead of `performSyncWorkOnRoot`.

The conceptual model is that the only difference between sync default
updates (in React 18) and concurrent default updates (in a future major
release) is time slicing. All other behavior should be the same
(i.e. the stuff in `finishConcurrentRender`).

Given this, I think it makes more sense to model the implementation this
way, too. This exposed a quirk in the previous implementation where
non-sync work was sometimes mistaken for sync work and flushed too
early. In the new implementation, `performSyncWorkOnRoot` is only used
for truly synchronous renders (i.e. `SyncLane`), which should make these
mistakes less common.

Fixes most of the tests marked with TODOs from react#21072.
@gaearon gaearon mentioned this pull request Mar 29, 2022
Add React 18 changelog #24195
Merged
mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
@rickhanlonii
Make time-slicing opt-in (react#21072)
68460cf
* Add enableSyncDefaultUpdates feature flag

* Add enableSyncDefaultUpdates implementation

* Fix tests

* Switch feature flag to true by default

* Finish concurrent render whenever for non-sync lanes

* Also return DefaultLane with eventLane

* Gate interruption test

* Add continuout native event test

* Fix tests from rebasing main

* Hardcode lanes, remove added export

* Sync forks
mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
@acdlite
Use performConcurrentWorkOnRoot for "sync default" (react#21322)
7c1c83d
Instead of `performSyncWorkOnRoot`.

The conceptual model is that the only difference between sync default
updates (in React 18) and concurrent default updates (in a future major
release) is time slicing. All other behavior should be the same
(i.e. the stuff in `finishConcurrentRender`).

Given this, I think it makes more sense to model the implementation this
way, too. This exposed a quirk in the previous implementation where
non-sync work was sometimes mistaken for sync work and flushed too
early. In the new implementation, `performSyncWorkOnRoot` is only used
for truly synchronous renders (i.e. `SyncLane`), which should make these
mistakes less common.

Fixes most of the tests marked with TODOs from react#21072.
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@rickhanlonii
Make time-slicing opt-in (react#21072)
9e407d4
* Add enableSyncDefaultUpdates feature flag

* Add enableSyncDefaultUpdates implementation

* Fix tests

* Switch feature flag to true by default

* Finish concurrent render whenever for non-sync lanes

* Also return DefaultLane with eventLane

* Gate interruption test

* Add continuout native event test

* Fix tests from rebasing main

* Hardcode lanes, remove added export

* Sync forks
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@acdlite
Use performConcurrentWorkOnRoot for "sync default" (react#21322)
8b6c642
Instead of `performSyncWorkOnRoot`.

The conceptual model is that the only difference between sync default
updates (in React 18) and concurrent default updates (in a future major
release) is time slicing. All other behavior should be the same
(i.e. the stuff in `finishConcurrentRender`).

Given this, I think it makes more sense to model the implementation this
way, too. This exposed a quirk in the previous implementation where
non-sync work was sometimes mistaken for sync work and flushed too
early. In the new implementation, `performSyncWorkOnRoot` is only used
for truly synchronous renders (i.e. `SyncLane`), which should make these
mistakes less common.

Fixes most of the tests marked with TODOs from react#21072.
@coderabbitai coderabbitai Bot mentioned this pull request Sep 22, 2026
refactor(core): fix check annotations siemens/ix#2721
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@acdlite acdlite acdlite approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@rickhanlonii rickhanlonii

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@rickhanlonii @sizebot @acdlite @facebook-github-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.