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 — [RTR] Add usage warning behind flag by jackpope · Pull Request #27903 · react/react

Conversation

@jackpope

@jackpope jackpope commented Jan 8, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Collaborator

Summary

Moving towards deprecation of ReactTestRenderer. Log a warning on each render so we can remove the exports in a future major version.

We can enable this flag in web RTR without disrupting RN tests by flipping the flag in packages/shared/forks/ReactFeatureFlags.test-renderer.js

How did you test this change?

yarn test packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.js

Sorry, something went wrong.

Uh oh!

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

lo1tuma reacted with thumbs down 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 Jan 8, 2024
@jackpope
jackpope requested review from acdlite and kassens January 8, 2024 20:52
@react-sizebot

react-sizebot commented Jan 8, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Comparing: 90a0ae1...113bf6f

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.87 kB 176.87 kB = 55.14 kB 55.14 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 178.97 kB 178.97 kB = 55.77 kB 55.77 kB
facebook-www/ReactDOM-prod.classic.js = 591.94 kB 591.94 kB = 104.47 kB 104.47 kB
facebook-www/ReactDOM-prod.modern.js = 575.23 kB 575.23 kB = 101.48 kB 101.48 kB
test_utils/ReactAllWarnings.js Deleted 67.04 kB 0.00 kB Deleted 16.43 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/cjs/react-jsx-runtime.react-server.production.js = 5.25 kB 5.21 kB = 2.25 kB 2.25 kB
oss-experimental/react/cjs/react-jsx-runtime.production.js = 5.18 kB 5.14 kB = 2.23 kB 2.23 kB
oss-experimental/react/cjs/react-jsx-runtime.profiling.js = 5.18 kB 5.14 kB = 2.23 kB 2.23 kB
test_utils/ReactAllWarnings.js Deleted 67.04 kB 0.00 kB Deleted 16.43 kB 0.00 kB

Generated by 🚫 dangerJS against 113bf6f

All reactions

Sorry, something went wrong.

Uh oh!

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

@jackpope
jackpope force-pushed the rtr-warning branch 2 times, most recently from e325338 to 05e79fb Compare January 8, 2024 22:27
rickhanlonii
rickhanlonii reviewed Jan 29, 2024
View reviewed changes
Comment thread packages/react-test-renderer/shallow.js Outdated

const emptyObject = {};

export default class ReactShallowRendererWithWarning extends ReactShallowRenderer {

@rickhanlonii rickhanlonii Jan 9, 2024

Copy link
Copy Markdown
Contributor

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 do you think about hoisting the feature flag check to the module level so the warning class is only included in builds where the warning is on? GCC will strip that class in builds that don't use it, and this will prevent the additional stack frame in errors for React Native.

Sorry, something went wrong.

Uh oh!

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

jackpope reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@jackpope jackpope Feb 16, 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.

I'm simplifying this PR by dropping the changes to the shallow entrypoint. It looks like we don't have shallow configured in rollup anymore and we may want to consider dropping it altogether as its been a separate package re-exported here for a while. Will follow up on this

Sorry, something went wrong.

Uh oh!

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

rickhanlonii reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread packages/react-test-renderer/shallow.js Outdated
if (enableReactTestRendererWarning === true) {
console.warn(
"React's Shallow Renderer export will be removed in a future release. " +
'Please use @testing-library/react instead.',

@rickhanlonii rickhanlonii Jan 9, 2024

Copy link
Copy Markdown
Contributor

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.

IMO we should provide a link here, that explains the deprecation better and we can keep the recommendations up to date on that page. Here's an example of where we've done this in the past: https://legacy.reactjs.org/warnings/legacy-factories.html

Sorry, something went wrong.

Uh oh!

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

jackpope reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@jackpope jackpope Feb 16, 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.

Updated with link to warning page

Sorry, something went wrong.

Uh oh!

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

All reactions
@jackpope
jackpope force-pushed the rtr-warning branch from afedfc5 to e24023b Compare February 16, 2024 19:59
rickhanlonii
rickhanlonii reviewed Feb 20, 2024
View reviewed changes
Comment thread packages/react-test-renderer/src/ReactTestRenderer.js Outdated
if (__DEV__) {
if (
enableReactTestRendererWarning === true &&
global.__REACT_DEVTOOLS_GLOBAL_HOOK__ == null

@rickhanlonii rickhanlonii Feb 20, 2024

Copy link
Copy Markdown
Contributor

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.

Why are we checking this?

Sorry, something went wrong.

Uh oh!

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

All reactions

@jackpope jackpope Feb 20, 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.

Dev tools rely on RTR a bunch within their testing. This avoid the warning there which breaks tests in CI. I can remove for now since this PR isn't turning on the flag yet.

Sorry, something went wrong.

Uh oh!

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

All reactions
rickhanlonii
rickhanlonii reviewed Feb 20, 2024
View reviewed changes
Comment thread packages/shared/ReactFeatureFlags.js Outdated
export const allowConcurrentByDefault = false;

// Warn on any usage of ReactTestRenderer
export const enableReactTestRendererWarning = false;

@rickhanlonii rickhanlonii Feb 20, 2024

Copy link
Copy Markdown
Contributor

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 can go in the Next Major section below.

Sorry, something went wrong.

Uh oh!

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

jackpope reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Jack Pope added 7 commits February 20, 2024 15:45
Jack Pope
[RTR] Add usage warning behind flag
ed56bb0
Jack Pope
Add test snapshot
3d3863d
Jack Pope
Conditional shallow export, update warning msg
3765904
Jack Pope
Move flag definition
866ea33
Jack Pope
Update msg in test
1176aed
Jack Pope
Skip warning msg for dev tools
6b5cc69
Jack Pope
Remove dev tools noop for now
113bf6f
@jackpope
jackpope force-pushed the rtr-warning branch from 97d4ba2 to 113bf6f Compare February 20, 2024 20:50
@jackpope jackpope mentioned this pull request Feb 22, 2024
[RTR] Enable warning flag #28419
Merged
rickhanlonii
rickhanlonii reviewed Feb 22, 2024
View reviewed changes
Comment thread packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.internal.js
describe('ReactTestRenderer', () => {
beforeEach(() => {
jest.resetModules();
ReactFeatureFlags.enableReactTestRendererWarning = false;

@rickhanlonii rickhanlonii Feb 22, 2024

Copy link
Copy Markdown
Contributor

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.

Can we use the @gate pragma?

Sorry, something went wrong.

Uh oh!

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

All reactions

@jackpope jackpope Feb 23, 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.

In the next PR we silence the warning to allow us to turn the flag on before all the React test cleanup is finished. So for now we don't necessarily expect a pass/fail on each side of the flag. Can probably update in the future or we'll see if we can remove the flag altogether

Sorry, something went wrong.

Uh oh!

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

All reactions
rickhanlonii
rickhanlonii approved these changes Feb 22, 2024
View reviewed changes

@rickhanlonii rickhanlonii left a comment

Copy link
Copy Markdown
Contributor

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.

LGTM

Sorry, something went wrong.

Uh oh!

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

All reactions
@jackpope
jackpope merged commit 66c8346 into react:main Feb 23, 2024
@jackpope
jackpope deleted the rtr-warning branch February 23, 2024 16:33
github-actions Bot pushed a commit that referenced this pull request Feb 23, 2024
@jackpope
[RTR] Add usage warning behind flag (#27903)
edd8fbe
## Summary

Moving towards deprecation of ReactTestRenderer. Log a warning on each
render so we can remove the exports in a future major version.

We can enable this flag in web RTR without disrupting RN tests by
flipping the flag in
`packages/shared/forks/ReactFeatureFlags.test-renderer.js`

## How did you test this change?

`yarn test
packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.js`

DiffTrain build for [66c8346](66c8346)
@huozhi huozhi mentioned this pull request Feb 26, 2024
Upgrade vendored react vercel/next.js#62549
Merged
huozhi added a commit to vercel/next.js that referenced this pull request Feb 26, 2024
@huozhi
Upgrade vendored react (#62549)
87015ac
### React upstream changes

- react/react#28438
- react/react#28436
- react/react#25954
- react/react#28434
- react/react#28433
- react/react#28432
- react/react#28415
- react/react#27903
- react/react#28430
- react/react#28424
- react/react#28400
- react/react#28422
- react/react#28423
- react/react#28412
- react/react#28418
- react/react#28421
- react/react#28417
- react/react#28399
- react/react#28408
- react/react#28350
- react/react#28387
- react/react#28403
- react/react#28384
- react/react#28409
- react/react#28398
- react/react#28405
- react/react#28328
- react/react#28402
- react/react#28386
- react/react#28388
- react/react#28379
- react/react#28383
- react/react#28390
- react/react#28389
- react/react#28382
- react/react#28348



Closes NEXT-2600
@ztanner ztanner mentioned this pull request Mar 19, 2024
(backport) Update React from 60a927d04 to 14898b6a9 vercel/next.js#63442
Closed
jackpope added a commit that referenced this pull request Mar 26, 2024
@jackpope
[RTR] Enable warning flag (#28419)
f73d11f
## Summary

Based on
- #27903

This PR
- Silence warning in React tests
- Turn on flag

We want to finish cleaning up internal RTR usage, but let's prioritize
the deprecation process. We do this by silencing the internal warning
for now.

## How did you test this change?

`yarn build`
`yarn test ReactHooksInspectionIntegration -b`
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
@jackpope @AndyPengc12
[RTR] Add usage warning behind flag (react#27903)
4e02501
## Summary

Moving towards deprecation of ReactTestRenderer. Log a warning on each
render so we can remove the exports in a future major version.

We can enable this flag in web RTR without disrupting RN tests by
flipping the flag in
`packages/shared/forks/ReactFeatureFlags.test-renderer.js`

## How did you test this change?

`yarn test
packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.js`
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
@jackpope @AndyPengc12
[RTR] Enable warning flag (react#28419)
45e62ac
## Summary

Based on
- react#27903

This PR
- Silence warning in React tests
- Turn on flag

We want to finish cleaning up internal RTR usage, but let's prioritize
the deprecation process. We do this by silencing the internal warning
for now.

## How did you test this change?

`yarn build`
`yarn test ReactHooksInspectionIntegration -b`
bigfootjon pushed a commit that referenced this pull request Apr 18, 2024
@jackpope
[RTR] Add usage warning behind flag (#27903)
86ff191
## Summary

Moving towards deprecation of ReactTestRenderer. Log a warning on each
render so we can remove the exports in a future major version.

We can enable this flag in web RTR without disrupting RN tests by
flipping the flag in
`packages/shared/forks/ReactFeatureFlags.test-renderer.js`

## How did you test this change?

`yarn test
packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.js`

DiffTrain build for commit 66c8346.
@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
@jackpope
[RTR] Add usage warning behind flag (react#27903)
f63db07
## Summary

Moving towards deprecation of ReactTestRenderer. Log a warning on each
render so we can remove the exports in a future major version.

We can enable this flag in web RTR without disrupting RN tests by
flipping the flag in
`packages/shared/forks/ReactFeatureFlags.test-renderer.js`

## How did you test this change?

`yarn test
packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.js`
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@jackpope
[RTR] Enable warning flag (react#28419)
8863308
## Summary

Based on
- react#27903

This PR
- Silence warning in React tests
- Turn on flag

We want to finish cleaning up internal RTR usage, but let's prioritize
the deprecation process. We do this by silencing the internal warning
for now.

## How did you test this change?

`yarn build`
`yarn test ReactHooksInspectionIntegration -b`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@acdlite acdlite Awaiting requested review from acdlite
@kassens kassens Awaiting requested review from kassens
1 more reviewer
@rickhanlonii rickhanlonii rickhanlonii approved these changes
Reviewers whose approvals may not affect merge requirements

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.

4 participants

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