GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — [RTR] Add usage warning behind flag by jackpope · Pull Request #27903 · react/react Conversation
|
|
Comparing: 90a0ae1...113bf6f Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: Expand to show
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
e325338 to
05e79fb
Compare
|
|
||
| const emptyObject = {}; | ||
|
|
||
| export default class ReactShallowRendererWithWarning extends ReactShallowRenderer { |
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
| if (enableReactTestRendererWarning === true) { | ||
| console.warn( | ||
| "React's Shallow Renderer export will be removed in a future release. " + | ||
| 'Please use @testing-library/react instead.', |
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
afedfc5 to
e24023b
Compare
| if (__DEV__) { | ||
| if ( | ||
| enableReactTestRendererWarning === true && | ||
| global.__REACT_DEVTOOLS_GLOBAL_HOOK__ == null |
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
| export const allowConcurrentByDefault = false; | ||
|
|
||
| // Warn on any usage of ReactTestRenderer | ||
| export const enableReactTestRendererWarning = false; |
There was a problem 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.
There was an error while loading. Please reload this page.
97d4ba2 to
113bf6f
Compare
| describe('ReactTestRenderer', () => { | ||
| beforeEach(() => { | ||
| jest.resetModules(); | ||
| ReactFeatureFlags.enableReactTestRendererWarning = false; |
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
## 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)
### 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
## 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`
## 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`
## 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`
## 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.
## 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`
## 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`
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.