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 — Noop unstable_batchedUpdates by rickhanlonii · Pull Request #28120 · react/react

Conversation

@rickhanlonii

@rickhanlonii rickhanlonii commented Jan 27, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Overview

unstable_batchedUpdates is effectively a no-op outside of legacy mode, this PR makes it an actual no-op outside legacy mode.

Sorry, something went wrong.

Uh oh!

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

All reactions
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Jan 27, 2024
@rickhanlonii
rickhanlonii force-pushed the rh/batched-noop branch from c6a06f7 to 4c4b9ae Compare January 27, 2024 00:26
@react-sizebot

react-sizebot commented Jan 27, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Comparing: 9f33f69...9d279d2

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.01% 176.93 kB 176.95 kB +0.02% 54.99 kB 55.01 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 173.11 kB 173.05 kB = 53.95 kB 53.95 kB
facebook-www/ReactDOM-prod.classic.js = 592.73 kB 592.75 kB +0.01% 103.97 kB 103.98 kB
facebook-www/ReactDOM-prod.modern.js +0.02% 574.31 kB 574.44 kB +0.02% 100.99 kB 101.00 kB
test_utils/ReactAllWarnings.js Deleted 65.19 kB 0.00 kB Deleted 16.30 kB 0.00 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
test_utils/ReactAllWarnings.js Deleted 65.19 kB 0.00 kB Deleted 16.30 kB 0.00 kB

Generated by 🚫 dangerJS against 9d279d2

All reactions

Sorry, something went wrong.

Uh oh!

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

@rickhanlonii
rickhanlonii force-pushed the rh/batched-noop branch 2 times, most recently from 34d6e25 to f792e8f Compare January 29, 2024 22:47
acdlite
acdlite reviewed Feb 1, 2024
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.

This makes the public API a no-op but React DOM's internals also call the batchedUpdates function exposed by the reconciler.

https://github.com/facebook/react/blob/2efa38332adc1fc1500753d79fcba41a0197a7a6/packages/react-dom/src/client/ReactDOM.js#L36

So for maximum safety I think we should fork the implementation here. That way we don't accidentally rely on the executionContext being set:

https://github.com/facebook/react/blob/2efa38332adc1fc1500753d79fcba41a0197a7a6/packages/react-reconciler/src/ReactFiberWorkLoop.js#L1436-L1455

I was thinking we would add a Fiber config like supportsLegacyMode and check that inside batchedUpdates.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread packages/react-dom/src/client/ReactDOM.js Resolved

Uh oh!

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

@acdlite

acdlite commented Feb 1, 2024

Copy link
Copy Markdown
Collaborator

We could also add a check in React DOM to remove the extra stack frame, too, but I would still fork the lower-level function just in case. Makes it easier to delete that code later when we delete the rest of legacy mode, too.

All reactions

Sorry, something went wrong.

Uh oh!

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

@rickhanlonii
rickhanlonii force-pushed the rh/batched-noop branch from f792e8f to e06ca02 Compare February 5, 2024 21:26
@rickhanlonii

rickhanlonii commented Feb 6, 2024

Copy link
Copy Markdown
Contributor Author

Oh, thanks @acdlite I didn't realize we also wanted to noop the internal batched updates.

I updated to use a feature flag. This means www will still use the real batchedUpdates even in createRoot, but that's how it works today and I can't figure out the right layering to prevent it. We could merge and follow up if it's a concern?

All reactions

Sorry, something went wrong.

Uh oh!

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

rickhanlonii
rickhanlonii commented Feb 6, 2024
View reviewed changes
Comment thread packages/react-dom/src/__tests__/ReactDOMHooks-test.js Resolved

Uh oh!

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

Comment thread packages/shared/ReactFeatureFlags.js Resolved

Uh oh!

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

@rickhanlonii
rickhanlonii requested a review from acdlite February 7, 2024 02:58
@gnoff

gnoff commented Feb 7, 2024

Copy link
Copy Markdown
Collaborator

There is a related task to move all the client apis into react-dom/client and make react-dom not import any of the client reconciler. I was hoping I could just make batched updates a noop there and not even import from react-reconciler however this would mean the implementation used internally would differ from the public API for legacy mode. I think we could solve this by exposing the reconciler version of batched updates on the meta entrypoints and using the basic noop implementation on OOS entrypoints since the flag should align behavior in this case.

I could implement it using a dispatcher of sorts but I'd like to avoid it if possible however I'll need the dispatcher for flushSync so it's not like I get to completely skip that whole concept even if we do go with this strategy

All reactions

Sorry, something went wrong.

Uh oh!

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

@rickhanlonii
rickhanlonii marked this pull request as draft March 26, 2024 17:06
@rickhanlonii
rickhanlonii force-pushed the rh/batched-noop branch 3 times, most recently from 6de030c to b383fae Compare March 27, 2024 21:27
@rickhanlonii
rickhanlonii marked this pull request as ready for review March 27, 2024 21:35
@rickhanlonii
rickhanlonii force-pushed the rh/batched-noop branch from b383fae to 61c03f5 Compare March 27, 2024 21:51
@rickhanlonii
Noop unstable_batchedUpdates
9d279d2
@rickhanlonii
rickhanlonii force-pushed the rh/batched-noop branch from 61c03f5 to 9d279d2 Compare March 27, 2024 22:01
rickhanlonii
rickhanlonii commented Mar 27, 2024
View reviewed changes
Comment thread packages/react-dom/src/__tests__/ReactLegacyMount-test.js
});

// @gate !disableLegacyMode
// @gate !disableLegacyMode && classic

@rickhanlonii rickhanlonii Mar 27, 2024

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.

Since this no-ops in every entry point except www-classic, these tests need the extra gate.

Sorry, something went wrong.

Uh oh!

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

All reactions
@rickhanlonii
rickhanlonii requested review from gnoff and sebmarkbage March 28, 2024 03:16
gnoff
gnoff approved these changes Mar 28, 2024
View reviewed changes
@rickhanlonii
rickhanlonii merged commit 63651c4 into react:main Mar 28, 2024
@rickhanlonii
rickhanlonii deleted the rh/batched-noop branch March 28, 2024 18:15
github-actions Bot pushed a commit that referenced this pull request Mar 28, 2024
@rickhanlonii
Noop unstable_batchedUpdates (#28120)
69b2f2d
## Overview

`unstable_batchedUpdates` is effectively a no-op outside of legacy mode,
this PR makes it an actual no-op outside legacy mode.

DiffTrain build for [63651c4](63651c4)
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
@rickhanlonii @AndyPengc12
Noop unstable_batchedUpdates (react#28120)
7edcf3f
## Overview

`unstable_batchedUpdates` is effectively a no-op outside of legacy mode,
this PR makes it an actual no-op outside legacy mode.
bigfootjon pushed a commit that referenced this pull request Apr 18, 2024
@rickhanlonii
Noop unstable_batchedUpdates (#28120)
cf341bf
## Overview

`unstable_batchedUpdates` is effectively a no-op outside of legacy mode,
this PR makes it an actual no-op outside legacy mode.

DiffTrain build for commit 63651c4.
This was referenced Apr 24, 2024
Update React from c3048aab4 to cb151849e1 vercel/next.js#64994
Closed
Support React 19 in App and Pages router vercel/next.js#65058
Merged
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@rickhanlonii
Noop unstable_batchedUpdates (react#28120)
43cae54
## Overview

`unstable_batchedUpdates` is effectively a no-op outside of legacy mode,
this PR makes it an actual no-op outside legacy mode.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gnoff gnoff gnoff approved these changes
@acdlite acdlite Awaiting requested review from acdlite
@sebmarkbage sebmarkbage Awaiting requested review from sebmarkbage

Uh oh!

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

Assignees

No one assigned

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.

5 participants

@rickhanlonii @react-sizebot @acdlite @gnoff @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.