Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(StrictMode): Double-invoke render for every component #18430

Merged
merged 2 commits into from
Mar 29, 2020

Conversation

eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented Mar 29, 2020

Summary

Closes #18426.

Essentially #14639 rebased with master where concerns were voiced about existing tests.

Test Plan

ReactHooks-internal is responsible for this test. This also affects any test counting renders.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Mar 29, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit e508cee:

Sandbox Source
autumn-surf-xpr5j Configuration
StrictMode /w and w/o Hooks Issue #18426

@sizebot
Copy link

sizebot commented Mar 29, 2020

Details of bundled changes.

Comparing: 1af2a10...e508cee

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.development.js -0.1% -0.0% 540.9 KB 540.57 KB 116.64 KB 116.59 KB NODE_DEV
react-art.production.min.js 0.0% -0.0% 71.47 KB 71.47 KB 21.57 KB 21.56 KB NODE_PROD
ReactART-dev.js -0.1% -0.0% 607.38 KB 606.88 KB 127.32 KB 127.28 KB FB_WWW_DEV
react-art.development.js -0.1% -0.0% 636.84 KB 636.49 KB 134.27 KB 134.24 KB UMD_DEV
react-art.production.min.js 0.0% 0.0% 106.42 KB 106.42 KB 32.3 KB 32.3 KB UMD_PROD

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.production.min.js 0.0% -0.0% 118.55 KB 118.55 KB 37.26 KB 37.26 KB NODE_PROD
react-dom-test-utils.development.js 0.0% -0.0% 59.23 KB 59.23 KB 15.64 KB 15.64 KB UMD_DEV
ReactDOMTesting-profiling.js 0.0% -0.0% 406 KB 406 KB 73.77 KB 73.77 KB FB_WWW_PROFILING
react-dom-server.browser.production.min.js 0.0% -0.0% 19.62 KB 19.62 KB 7.29 KB 7.28 KB NODE_PROD
react-dom-unstable-fizz.browser.development.js 0.0% -0.2% 3.34 KB 3.34 KB 1.26 KB 1.26 KB UMD_DEV
react-dom.profiling.min.js 0.0% 0.0% 122.4 KB 122.4 KB 38.41 KB 38.42 KB NODE_PROFILING
react-dom-test-utils.production.min.js 0.0% 0.0% 12.25 KB 12.25 KB 4.54 KB 4.54 KB UMD_PROD
react-dom-unstable-fizz.browser.production.min.js 0.0% -0.3% 1.17 KB 1.17 KB 691 B 689 B UMD_PROD
react-dom-server.node.development.js 0.0% -0.0% 127.53 KB 127.53 KB 34.09 KB 34.09 KB NODE_DEV
react-dom-server.node.production.min.js 0.0% -0.0% 20.03 KB 20.03 KB 7.44 KB 7.44 KB NODE_PROD
ReactDOMForked-dev.js -0.0% -0.0% 1008.64 KB 1008.15 KB 224.19 KB 224.14 KB FB_WWW_DEV
react-dom-unstable-fizz.node.development.js 0.0% -0.1% 3.68 KB 3.68 KB 1.33 KB 1.33 KB NODE_DEV
react-dom.development.js -0.0% -0.0% 908.87 KB 908.53 KB 199.94 KB 199.91 KB UMD_DEV
react-dom-server.browser.development.js 0.0% -0.0% 133.15 KB 133.15 KB 34.27 KB 34.27 KB UMD_DEV
react-dom-unstable-fizz.node.production.min.js 0.0% -0.2% 1.15 KB 1.15 KB 653 B 652 B NODE_PROD
react-dom-server.browser.production.min.js 0.0% -0.0% 19.71 KB 19.71 KB 7.34 KB 7.34 KB UMD_PROD
ReactDOMTesting-dev.js 0.0% -0.0% 946.27 KB 946.27 KB 211.29 KB 211.29 KB FB_WWW_DEV
react-dom.development.js -0.0% -0.0% 865.15 KB 864.82 KB 197.49 KB 197.47 KB NODE_DEV
ReactDOMTesting-prod.js 0.0% -0.0% 406 KB 406 KB 73.77 KB 73.77 KB FB_WWW_PROD
ReactDOM-dev.js -0.0% -0.0% 1008.64 KB 1008.15 KB 224.19 KB 224.14 KB FB_WWW_DEV
ReactDOMServer-dev.js 0.0% -0.0% 136.32 KB 136.32 KB 34.74 KB 34.74 KB FB_WWW_DEV
react-dom-test-utils.development.js 0.0% -0.0% 54.69 KB 54.69 KB 15.03 KB 15.03 KB NODE_DEV
ReactDOMServer-prod.js 0.0% -0.0% 46.62 KB 46.62 KB 10.86 KB 10.86 KB FB_WWW_PROD
react-dom-unstable-fizz.browser.development.js 0.0% -0.2% 2.94 KB 2.94 KB 1.17 KB 1.17 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% -0.0% 12.1 KB 12.1 KB 4.47 KB 4.47 KB NODE_PROD
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 57.7 KB 57.7 KB 14.36 KB 14.36 KB UMD_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% -0.3% 1013 B 1013 B 603 B 601 B NODE_PROD
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.0% 10.31 KB 10.31 KB 3.49 KB 3.49 KB UMD_PROD
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 54.71 KB 54.71 KB 14.14 KB 14.13 KB NODE_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.0% 10.04 KB 10.04 KB 3.37 KB 3.37 KB NODE_PROD

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler.development.js -0.1% -0.0% 578.94 KB 578.61 KB 122.44 KB 122.42 KB NODE_DEV
react-reconciler-reflection.development.js 0.0% -0.0% 15.55 KB 15.55 KB 4.73 KB 4.73 KB NODE_DEV
react-reconciler.production.min.js 0.0% -0.0% 76.31 KB 76.31 KB 22.64 KB 22.64 KB NODE_PROD
react-reconciler-reflection.production.min.js 0.0% -0.1% 2.57 KB 2.57 KB 1.08 KB 1.08 KB NODE_PROD

ReactDOM: size: 0.0%, gzip: 0.0%

Size changes (stable)

Generated by 🚫 dangerJS against e508cee

@sizebot
Copy link

sizebot commented Mar 29, 2020

Details of bundled changes.

Comparing: 1af2a10...e508cee

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom-server.browser.production.min.js 0.0% -0.0% 20.17 KB 20.17 KB 7.4 KB 7.4 KB UMD_PROD
react-dom-unstable-fizz.browser.development.js 0.0% -0.2% 3.35 KB 3.35 KB 1.27 KB 1.27 KB UMD_DEV
ReactDOM-dev.js -0.1% -0.0% 962.79 KB 962.29 KB 214.16 KB 214.08 KB FB_WWW_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% -0.3% 1.19 KB 1.19 KB 699 B 697 B UMD_PROD
ReactDOM-profiling.js 0.0% -0.0% 416.74 KB 416.74 KB 75.49 KB 75.48 KB FB_WWW_PROFILING
react-dom-unstable-fizz.browser.development.js 0.0% -0.2% 2.95 KB 2.95 KB 1.18 KB 1.18 KB NODE_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% -0.3% 1 KB 1 KB 611 B 609 B NODE_PROD
react-dom-test-utils.development.js 0.0% -0.0% 59.24 KB 59.24 KB 15.65 KB 15.65 KB UMD_DEV
ReactDOMTesting-dev.js 0.0% -0.0% 919.51 KB 919.51 KB 205.39 KB 205.38 KB FB_WWW_DEV
react-dom-test-utils.development.js 0.0% -0.0% 54.7 KB 54.7 KB 15.03 KB 15.03 KB NODE_DEV
react-dom-server.node.development.js 0.0% -0.0% 129.05 KB 129.05 KB 34.3 KB 34.3 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% -0.0% 12.12 KB 12.12 KB 4.48 KB 4.48 KB NODE_PROD
react-dom-server.browser.development.js 0.0% -0.0% 127.83 KB 127.83 KB 34.05 KB 34.05 KB NODE_DEV
react-dom.development.js -0.0% -0.0% 939.02 KB 938.56 KB 205.19 KB 205.16 KB UMD_DEV
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 57.71 KB 57.71 KB 14.36 KB 14.36 KB UMD_DEV
ReactDOMForked-dev.js -0.1% -0.0% 962.79 KB 962.29 KB 214.16 KB 214.08 KB FB_WWW_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.0% 10.32 KB 10.32 KB 3.49 KB 3.49 KB UMD_PROD
ReactDOMServer-dev.js 0.0% -0.0% 135.47 KB 135.47 KB 34.6 KB 34.6 KB FB_WWW_DEV
ReactDOMServer-prod.js 0.0% -0.0% 45.91 KB 45.91 KB 10.67 KB 10.67 KB FB_WWW_PROD
react-dom.development.js -0.0% -0.0% 894.04 KB 893.6 KB 202.7 KB 202.67 KB NODE_DEV
ReactDOMForked-profiling.js 0.0% -0.0% 416.74 KB 416.74 KB 75.49 KB 75.48 KB FB_WWW_PROFILING
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 54.72 KB 54.72 KB 14.14 KB 14.14 KB NODE_DEV
react-dom-unstable-fizz.node.development.js 0.0% -0.1% 3.69 KB 3.69 KB 1.34 KB 1.34 KB NODE_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.0% 10.05 KB 10.05 KB 3.38 KB 3.38 KB NODE_PROD
react-dom-unstable-fizz.node.production.min.js 0.0% -0.2% 1.16 KB 1.16 KB 662 B 661 B NODE_PROD

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactART-dev.js -0.1% -0.0% 579.3 KB 578.81 KB 121.65 KB 121.6 KB FB_WWW_DEV
react-art.development.js -0.1% -0.0% 657.47 KB 657 KB 137.97 KB 137.95 KB UMD_DEV
react-art.production.min.js 0.0% -0.0% 109 KB 109 KB 33.06 KB 33.06 KB UMD_PROD
react-art.development.js -0.1% -0.0% 560.72 KB 560.28 KB 120.36 KB 120.32 KB NODE_DEV

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-dev.js -0.1% -0.0% 657.7 KB 657.33 KB 142.08 KB 142.04 KB RN_FB_DEV
ReactFabric-dev.js 0.0% -0.0% 636.85 KB 636.85 KB 137.34 KB 137.34 KB RN_OSS_DEV
ReactFabric-prod.js 0.0% 0.0% 260.81 KB 260.81 KB 45.16 KB 45.16 KB RN_OSS_PROD
ReactFabric-profiling.js 0.0% 0.0% 272.65 KB 272.65 KB 47.39 KB 47.4 KB RN_OSS_PROFILING
ReactFabric-dev.js -0.1% -0.0% 639.57 KB 639.2 KB 137.67 KB 137.62 KB RN_FB_DEV
ReactNativeRenderer-prod.js 0.0% -0.0% 268.82 KB 268.82 KB 46.64 KB 46.64 KB RN_OSS_PROD
ReactNativeRenderer-profiling.js 0.0% -0.0% 280.67 KB 280.67 KB 48.89 KB 48.89 KB RN_OSS_PROFILING

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler-reflection.development.js 0.0% -0.0% 15.56 KB 15.56 KB 4.73 KB 4.73 KB NODE_DEV
react-reconciler-reflection.production.min.js 0.0% -0.1% 2.58 KB 2.58 KB 1.09 KB 1.09 KB NODE_PROD
react-reconciler.development.js -0.1% -0.0% 601.08 KB 600.65 KB 126.67 KB 126.63 KB NODE_DEV

ReactDOM: size: 0.0%, gzip: -0.0%

Size changes (experimental)

Generated by 🚫 dangerJS against e508cee

@gaearon
Copy link
Collaborator

gaearon commented Mar 29, 2020

Seems like bundle tests fail.

@eps1lon
Copy link
Collaborator Author

eps1lon commented Mar 29, 2020

Seems like bundle tests fail.

It seems like react-test-renderer is not using beginWork from the react-reconciler package in test-build (but is in test).

Apparently test-build rewrites some react-reconciler/ imports but I'm a bit confused why react-reconciler sometimes imports via relative specifier (e.g. ./ReactFiberRoot) and sometimes via deep specifier (e.g. react-reconciler/src/ReactRootTags). Maybe I'm looking in the wrong spot.

@eps1lon
Copy link
Collaborator Author

eps1lon commented Mar 29, 2020

Following https://github.com/facebook/react/pull/14639/files#diff-0b241de0dfec2d07bb2b2fef76b254d2R11-R24 though I don't think I understand the distinction between source and build tests.

@gaearon
Copy link
Collaborator

gaearon commented Mar 29, 2020

It seems like react-test-renderer is not using beginWork from the react-reconciler package in test-build (but is in test).

Not sure what you mean by this. In the bundle tests, react-reconciler is bundled inside of react-test-renderer bundle. Just like it's bundled inside of react-dom.

The difference is that you can't set feature flags for bundle tests. Because nothing will read them. They're already compiled away.

@gaearon gaearon merged commit ba31ad4 into facebook:master Mar 29, 2020
@gaearon
Copy link
Collaborator

gaearon commented Mar 29, 2020

Looks good. Thanks.

This was referenced Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Call all functions twice in StrictMode
4 participants