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 — [DOM] disable legacy mode behind flag by gnoff · Pull Request #28468 · react/react

Conversation

@gnoff

@gnoff gnoff commented Feb 29, 2024

Copy link
Copy Markdown
Collaborator

Adds a flag to disable legacy mode. Currently this flag is used to cause legacy mode apis like render and hydrate to throw. This change also removes render, hydrate, unmountComponentAtNode, and unstable_renderSubtreeIntoContainer from the experiemntal entrypoint. Right now for Meta builds this flag is off (legacy mode is still supported). In OSS builds this flag matches NEXT_MAJOR which means it currently is on in experiemental. This means that after merging legacy mode is effectively removed from experimental builds. While this is a breaking change, experimental builds are not stable and users can pin to older versions or update their use of react-dom to no longer use legacy mode APIs.

Sorry, something went wrong.

Uh oh!

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

apostolos reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Feb 29, 2024
gnoff
gnoff commented Feb 29, 2024
View reviewed changes

@gnoff gnoff left a comment

Copy link
Copy Markdown
Collaborator 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.

Most of this diff is updates to tests to disable tests that are exclusively asserting legacy behavior. There are a few instances where the test was not asserting legacy behavior and I just updated the test to not rely upon legacy roots

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread packages/react-dom/index.experimental.js
Comment on lines -17 to -21
hydrate,
render,
unmountComponentAtNode,
unstable_batchedUpdates,
unstable_renderSubtreeIntoContainer,

@gnoff gnoff Feb 29, 2024

Copy link
Copy Markdown
Collaborator 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.

Here we remove the apis from experimental entrypoint

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/ReactDOMLegacy.js
Comment on lines +268 to +275
if (disableLegacyMode) {
if (__DEV__) {
console.error(
'ReactDOM.hydrate is no longer supported in React 18. Use hydrateRoot instead',
);
}
throw new Error('ReactDOM: Unsupported Legacy Mode API.');
}

@gnoff gnoff Feb 29, 2024

Copy link
Copy Markdown
Collaborator 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.

As an extra precaution this interrupts the hydrate and render APIs. In practice this should be unobservable but if the flag were turned on without a corresponding change in the entrypoints it would at least prevent relying on the functions that can create legacy roots

Sorry, something went wrong.

Uh oh!

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

All reactions
@gnoff
gnoff requested a review from acdlite February 29, 2024 01:01
@gnoff

gnoff commented Feb 29, 2024

Copy link
Copy Markdown
Collaborator Author

supercedes: #27596

I took a slightly different approach but I don't think we need specific error messages for each removed API, we just want to remove them so they are no longer defined in builds that do not support legacy mode. We can't land this in Canary until canary is on React 19

All reactions

Sorry, something went wrong.

Uh oh!

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

@gnoff
gnoff force-pushed the flag-legacy-mode branch from a913625 to 789d1cf Compare February 29, 2024 01:05
@react-sizebot

react-sizebot commented Feb 29, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Comparing: 034130c...d0e460d

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 = 176.93 kB 176.93 kB = 55.14 kB 55.14 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 179.07 kB 177.46 kB = 55.82 kB 55.45 kB
facebook-www/ReactDOM-prod.classic.js = 594.04 kB 594.04 kB = 104.94 kB 104.94 kB
facebook-www/ReactDOM-prod.modern.js = 577.32 kB 577.32 kB = 101.96 kB 101.96 kB
test_utils/ReactAllWarnings.js Deleted 66.32 kB 0.00 kB Deleted 16.26 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
oss-experimental/react-dom/cjs/react-dom.profiling.js = 1,004.68 kB 999.15 kB = 223.59 kB 222.74 kB
oss-experimental/react-dom/cjs/react-dom-unstable_testing.production.js = 980.87 kB 975.34 kB = 220.56 kB 219.72 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 962.89 kB 957.36 kB = 216.06 kB 215.22 kB
oss-experimental/react-dom/cjs/react-dom-unstable_testing.development.js = 1,369.68 kB 1,358.19 kB = 302.50 kB 300.53 kB
oss-experimental/react-dom/umd/react-dom.profiling.min.js = 187.80 kB 186.22 kB = 58.48 kB 58.08 kB
oss-experimental/react-dom/umd/react-dom.development.js = 1,416.84 kB 1,404.86 kB = 301.27 kB 299.26 kB
oss-experimental/react-dom/cjs/react-dom.development.js = 1,351.82 kB 1,340.34 kB = 298.24 kB 296.25 kB
oss-experimental/react-dom/cjs/react-dom.profiling.min.js = 188.54 kB 186.94 kB = 58.17 kB 57.82 kB
oss-experimental/react-dom/cjs/react-dom-unstable_testing.production.min.js = 185.12 kB 183.51 kB = 58.10 kB 57.72 kB
oss-experimental/react-dom/umd/react-dom.production.min.js = 178.77 kB 177.19 kB = 56.13 kB 55.74 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 179.07 kB 177.46 kB = 55.82 kB 55.45 kB
test_utils/ReactAllWarnings.js Deleted 66.32 kB 0.00 kB Deleted 16.26 kB 0.00 kB

Generated by 🚫 dangerJS against d0e460d

All reactions

Sorry, something went wrong.

Uh oh!

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

acdlite
acdlite approved these changes Feb 29, 2024
View reviewed changes
@gnoff
gnoff force-pushed the flag-legacy-mode branch from 789d1cf to dbdf4ca Compare February 29, 2024 16:16
gnoff
gnoff commented Feb 29, 2024
View reviewed changes
Comment thread packages/react-dom/src/__tests__/renderSubtreeIntoContainer-test.js
Comment on lines -97 to -101
componentDidMount() {
expect(function () {
renderSubtreeIntoContainer(<Parent />, <Component />, portal);
}).toThrowError('parentComponentmust be a valid React Component');
}

@gnoff gnoff Feb 29, 2024

Copy link
Copy Markdown
Collaborator 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.

This test has been a noop for 7 years so I removed it. If we want to add a proper test for this warning we need to construct it differently

Sorry, something went wrong.

Uh oh!

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

All reactions
@gnoff
gnoff force-pushed the flag-legacy-mode branch from cd91f70 to 4ede68e Compare March 1, 2024 05:48
eps1lon
eps1lon reviewed Mar 1, 2024
View reviewed changes
Comment thread packages/react-reconciler/src/__tests__/ReactUpdaters-test.internal.js
Comment on lines +265 to +267
// This test should be convertable to createRoot but the allScheduledTypes assertions are no longer the same
// So I'm leaving it in legacy mode for now and just disabling if legacy mode is turned off
// @gate !disableLegacyMode

@eps1lon eps1lon Mar 1, 2024

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 was my latest finding regarding the change of scheduler types: #28330 (comment)

Haven't looked deeper into it.

Sorry, something went wrong.

Uh oh!

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

gnoff reacted with heart emoji
All reactions
  • ❤️ 1 reaction
gnoff added 2 commits March 4, 2024 08:06
@gnoff
Adds a flag to disable legacy mode. Currently this flag is used to ca…
9770f8d
…use legacy mode apis like render and hydrate to throw. This change also removes render, hydrate, unmountComponentAtNode, and unstable_renderSubtreeIntoContainer from the experiemntal entrypoint. Right now for Meta builds this flag is off (legacy mode is still supported). In OSS builds this flag matches __NEXT_MAJOR__ which means it currently is on in experiemental. This means that after merging legacy mode is effectively removed from experimental builds. While this is a breaking change, experimental builds are not stable and users can pin to older versions or update their use of react-dom to no longer use legacy mode APIs.
@gnoff
Add gates to devtools tests using legacy mode
d0e460d
@gnoff
gnoff force-pushed the flag-legacy-mode branch from 4ede68e to d0e460d Compare March 4, 2024 16:07
@gnoff
gnoff merged commit 1c02b9d into react:main Mar 4, 2024
@gnoff
gnoff deleted the flag-legacy-mode branch March 4, 2024 16:19
github-actions Bot pushed a commit that referenced this pull request Mar 4, 2024
@gnoff
[DOM] disable legacy mode behind flag (#28468)
54b3557
Adds a flag to disable legacy mode. Currently this flag is used to cause
legacy mode apis like render and hydrate to throw. This change also
removes render, hydrate, unmountComponentAtNode, and
unstable_renderSubtreeIntoContainer from the experiemntal entrypoint.
Right now for Meta builds this flag is off (legacy mode is still
supported). In OSS builds this flag matches __NEXT_MAJOR__ which means
it currently is on in experiemental. This means that after merging
legacy mode is effectively removed from experimental builds. While this
is a breaking change, experimental builds are not stable and users can
pin to older versions or update their use of react-dom to no longer use
legacy mode APIs.

DiffTrain build for [1c02b9d](1c02b9d)
@hoxyq hoxyq mentioned this pull request Mar 5, 2024
React DevTools 5.0.1 -> 5.0.2 #28496
Merged
hoxyq added a commit that referenced this pull request Mar 5, 2024
@hoxyq
React DevTools 5.0.1 -> 5.0.2 (#28496)
966d174
* feat[devtools]: symbolicate source for inspected element
([hoxyq](https://github.com/hoxyq) in
[#28471](#28471))
* refactor[devtools]: lazily define source for fiber based on component
stacks ([hoxyq](https://github.com/hoxyq) in
[#28351](#28351))
* fix[devtools/tree/element]: onClick -> onMouseDown to handle first
click correctly ([hoxyq](https://github.com/hoxyq) in
[#28486](#28486))
* [DOM] disable legacy mode behind flag
([gnoff](https://github.com/gnoff) in
[#28468](#28468))
* Fix Broken Links In Documentation
([justindhillon](https://github.com/justindhillon) in
[#28321](#28321))
* Update /link URLs to react.dev
([rickhanlonii](https://github.com/rickhanlonii) in
[#28477](#28477))
* [tests] add support for @gate pragma
([gnoff](https://github.com/gnoff) in
[#28479](#28479))
* Devtools: Unwrap Promise in useFormState
([eps1lon](https://github.com/eps1lon) in
[#28319](#28319))
* Add support for rendering BigInt
([eps1lon](https://github.com/eps1lon) in
[#24580](#24580))
* Include server component names in the componentStack in DEV
([sebmarkbage](https://github.com/sebmarkbage) in
[#28415](#28415))
@ztanner ztanner mentioned this pull request Mar 18, 2024
Update React from 6c3b8dbfe to a4939017f vercel/next.js#63413
Closed
@gnoff gnoff mentioned this pull request Mar 25, 2024
Update React from 14898b6a9 to e373190fa vercel/next.js#63685
Closed
gnoff added a commit to gnoff/next.js that referenced this pull request Mar 25, 2024
@gnoff
Update React from 14898b6a9 to e373190fa
1a2ce1f
- react/react#28596
- react/react#28625
- react/react#28616
- react/react#28491
- react/react#28583
- react/react#28427
- react/react#28613
- react/react#28599
- react/react#28611
- react/react#28610
- react/react#28606
- react/react#28598
- react/react#28549
- react/react#28557
- react/react#28467
- react/react#28591
- react/react#28459
- react/react#28590
- react/react#28564
- react/react#28582
- react/react#28579
- react/react#28578
- react/react#28521
- react/react#28550
- react/react#28576
- react/react#28577
- react/react#28571
- react/react#28572
- react/react#28560
- react/react#28569
- react/react#28573
- react/react#28546
- react/react#28568
- react/react#28562
- react/react#28566
- react/react#28565
- react/react#28559
- react/react#28508
- react/react#20432
- react/react#28555
- react/react#24730
- react/react#28472
- react/react#27991
- react/react#28514
- react/react#28548
- react/react#28526
- react/react#28515
- react/react#28533
- react/react#28532
- react/react#28531
- react/react#28407
- react/react#28522
- react/react#28538
- react/react#28509
- react/react#28534
- react/react#28527
- react/react#28528
- react/react#28519
- react/react#28411
- react/react#28520
- react/react#28518
- react/react#28493
- react/react#28504
- react/react#28499
- react/react#28501
- react/react#28496
- react/react#28471
- react/react#28351
- react/react#28486
- react/react#28490
- react/react#28488
- react/react#28468
- react/react#28321
- react/react#28477
- react/react#28479
- react/react#28480
- react/react#28478
- react/react#28464
- react/react#28475
- react/react#28456
- react/react#28319
- react/react#28345
- react/react#28337
- react/react#28335
- react/react#28466
- react/react#28462
- react/react#28322
- react/react#28444
- react/react#28448
- react/react#28449
- react/react#28446
- react/react#28447
- react/react#24580
@ztanner ztanner mentioned this pull request Apr 2, 2024
Update React from 14898b6a9 to a870b2d54 vercel/next.js#63976
Closed
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
@gnoff @AndyPengc12
[DOM] disable legacy mode behind flag (react#28468)
5f2afe0
Adds a flag to disable legacy mode. Currently this flag is used to cause
legacy mode apis like render and hydrate to throw. This change also
removes render, hydrate, unmountComponentAtNode, and
unstable_renderSubtreeIntoContainer from the experiemntal entrypoint.
Right now for Meta builds this flag is off (legacy mode is still
supported). In OSS builds this flag matches __NEXT_MAJOR__ which means
it currently is on in experiemental. This means that after merging
legacy mode is effectively removed from experimental builds. While this
is a breaking change, experimental builds are not stable and users can
pin to older versions or update their use of react-dom to no longer use
legacy mode APIs.
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
@hoxyq @AndyPengc12
React DevTools 5.0.1 -> 5.0.2 (react#28496)
8e68237
* feat[devtools]: symbolicate source for inspected element
([hoxyq](https://github.com/hoxyq) in
[react#28471](react#28471))
* refactor[devtools]: lazily define source for fiber based on component
stacks ([hoxyq](https://github.com/hoxyq) in
[react#28351](react#28351))
* fix[devtools/tree/element]: onClick -> onMouseDown to handle first
click correctly ([hoxyq](https://github.com/hoxyq) in
[react#28486](react#28486))
* [DOM] disable legacy mode behind flag
([gnoff](https://github.com/gnoff) in
[react#28468](react#28468))
* Fix Broken Links In Documentation
([justindhillon](https://github.com/justindhillon) in
[react#28321](react#28321))
* Update /link URLs to react.dev
([rickhanlonii](https://github.com/rickhanlonii) in
[react#28477](react#28477))
* [tests] add support for @gate pragma
([gnoff](https://github.com/gnoff) in
[react#28479](react#28479))
* Devtools: Unwrap Promise in useFormState
([eps1lon](https://github.com/eps1lon) in
[react#28319](react#28319))
* Add support for rendering BigInt
([eps1lon](https://github.com/eps1lon) in
[react#24580](react#24580))
* Include server component names in the componentStack in DEV
([sebmarkbage](https://github.com/sebmarkbage) in
[react#28415](react#28415))
bigfootjon pushed a commit that referenced this pull request Apr 18, 2024
@gnoff
[DOM] disable legacy mode behind flag (#28468)
7a7b277
Adds a flag to disable legacy mode. Currently this flag is used to cause
legacy mode apis like render and hydrate to throw. This change also
removes render, hydrate, unmountComponentAtNode, and
unstable_renderSubtreeIntoContainer from the experiemntal entrypoint.
Right now for Meta builds this flag is off (legacy mode is still
supported). In OSS builds this flag matches __NEXT_MAJOR__ which means
it currently is on in experiemental. This means that after merging
legacy mode is effectively removed from experimental builds. While this
is a breaking change, experimental builds are not stable and users can
pin to older versions or update their use of react-dom to no longer use
legacy mode APIs.

DiffTrain build for commit 1c02b9d.
@eps1lon eps1lon mentioned this pull request Apr 19, 2024
Update React from 14898b6a9 to c3048aab4 vercel/next.js#64798
Merged
Akshato07 pushed a commit to Akshato07/-Luffy that referenced this pull request Feb 20, 2025
@hoxyq
React DevTools 5.0.1 -> 5.0.2 (#28496)
010c604
* feat[devtools]: symbolicate source for inspected element
([hoxyq](https://github.com/hoxyq) in
[#28471](react/react#28471))
* refactor[devtools]: lazily define source for fiber based on component
stacks ([hoxyq](https://github.com/hoxyq) in
[#28351](react/react#28351))
* fix[devtools/tree/element]: onClick -> onMouseDown to handle first
click correctly ([hoxyq](https://github.com/hoxyq) in
[#28486](react/react#28486))
* [DOM] disable legacy mode behind flag
([gnoff](https://github.com/gnoff) in
[#28468](react/react#28468))
* Fix Broken Links In Documentation
([justindhillon](https://github.com/justindhillon) in
[#28321](react/react#28321))
* Update /link URLs to react.dev
([rickhanlonii](https://github.com/rickhanlonii) in
[#28477](react/react#28477))
* [tests] add support for @gate pragma
([gnoff](https://github.com/gnoff) in
[#28479](react/react#28479))
* Devtools: Unwrap Promise in useFormState
([eps1lon](https://github.com/eps1lon) in
[#28319](react/react#28319))
* Add support for rendering BigInt
([eps1lon](https://github.com/eps1lon) in
[#24580](react/react#24580))
* Include server component names in the componentStack in DEV
([sebmarkbage](https://github.com/sebmarkbage) in
[#28415](react/react#28415))

DiffTrain build for commit react/react@966d174.
@fossabot fossabot Bot mentioned this pull request Oct 2, 2025
Bump react and @types/react in /web-app franchb/console#14
Open
@fossabot fossabot Bot mentioned this pull request Oct 20, 2025
chore(deps): bump react and @types/react blinklabs-io/after-town-hall#281
Closed
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@gnoff
[DOM] disable legacy mode behind flag (react#28468)
f236ca2
Adds a flag to disable legacy mode. Currently this flag is used to cause
legacy mode apis like render and hydrate to throw. This change also
removes render, hydrate, unmountComponentAtNode, and
unstable_renderSubtreeIntoContainer from the experiemntal entrypoint.
Right now for Meta builds this flag is off (legacy mode is still
supported). In OSS builds this flag matches __NEXT_MAJOR__ which means
it currently is on in experiemental. This means that after merging
legacy mode is effectively removed from experimental builds. While this
is a breaking change, experimental builds are not stable and users can
pin to older versions or update their use of react-dom to no longer use
legacy mode APIs.
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@hoxyq
React DevTools 5.0.1 -> 5.0.2 (react#28496)
dbdc0fb
* feat[devtools]: symbolicate source for inspected element
([hoxyq](https://github.com/hoxyq) in
[react#28471](react#28471))
* refactor[devtools]: lazily define source for fiber based on component
stacks ([hoxyq](https://github.com/hoxyq) in
[react#28351](react#28351))
* fix[devtools/tree/element]: onClick -> onMouseDown to handle first
click correctly ([hoxyq](https://github.com/hoxyq) in
[react#28486](react#28486))
* [DOM] disable legacy mode behind flag
([gnoff](https://github.com/gnoff) in
[react#28468](react#28468))
* Fix Broken Links In Documentation
([justindhillon](https://github.com/justindhillon) in
[react#28321](react#28321))
* Update /link URLs to react.dev
([rickhanlonii](https://github.com/rickhanlonii) in
[react#28477](react#28477))
* [tests] add support for @gate pragma
([gnoff](https://github.com/gnoff) in
[react#28479](react#28479))
* Devtools: Unwrap Promise in useFormState
([eps1lon](https://github.com/eps1lon) in
[react#28319](react#28319))
* Add support for rendering BigInt
([eps1lon](https://github.com/eps1lon) in
[react#24580](react#24580))
* Include server component names in the componentStack in DEV
([sebmarkbage](https://github.com/sebmarkbage) in
[react#28415](react#28415))
This was referenced Nov 22, 2026
deps: update react to 19.3.1 shadrxcc/porncrit-fe#12
Merged
deps: update react to 19.3.1 linda-ochem/temp#1
Merged
deps: update react to 19.3.1 shadrxcc/lifelineai#4
Merged
deps: update react to 19.3.1 shadrxcc/lifelineai#16
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@eps1lon eps1lon eps1lon left review comments
@acdlite acdlite acdlite approved these changes

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

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