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

Fix act bundle size regression #19832

Merged
merged 1 commit into from
Sep 14, 2020

Conversation

acdlite
Copy link
Collaborator

@acdlite acdlite commented Sep 14, 2020

Adds back the TestUtils.act implementation that I had removed in #19745. This version of act is implemented in "userspace" (i.e. not the reconciler), so it doesn't add to the production bundle size.

I had removed this in #19745 in favor of the act exported by the reconciler because I thought we would remove support for act in production in the impending major release. (It currently warns.)

However, we've since decided to continue supporting act in prod for now, so that it doesn't block people from upgrading to v17. We'll drop support in a future major release.

So, to avoid bloating the production bundle size, we need to move the public version of act back to "userspace", like it was before.

This doesn't negate the main goal of #19745, though, which was to decouple the public version(s) of act from the internal one that we use to test React itself.

Adds back the `TestUtils.act` implementation that I had removed
in facebook#19745. This version of `act` is implemented in "userspace" (i.e. not
the reconciler), so it doesn't add to the production bundle size.

I had removed this in facebook#19745 in favor of the `act` exported by the
reconciler because I thought we would remove support for `act` in
production in the impending major release. (It currently warns.)

However, we've since decided to continue supporting `act` in prod for
now, so that it doesn't block people from upgrading to v17. We'll drop
support in a future major release.

So, to avoid bloating the production bundle size, we need to move the
public version of `act` back to "userspace", like it was before.

This doesn't negate the main goal of facebook#19745, though, which was to
decouple the public version(s) of `act` from the internal one that we
use to test React itself.
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Sep 14, 2020
@codesandbox-ci
Copy link

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 62105de:

Sandbox Source
React Configuration

@sizebot
Copy link

sizebot commented Sep 14, 2020

Details of bundled changes.

Comparing: ec39a5e...62105de

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js -0.6% -0.8% 909.67 KB 903.97 KB 207.47 KB 205.9 KB NODE_DEV
ReactDOMForked-prod.js -0.8% -1.1% 378.21 KB 375 KB 70.38 KB 69.59 KB FB_WWW_PROD
react-dom.production.min.js -0.9% -1.2% 123.22 KB 122.16 KB 39.8 KB 39.31 KB NODE_PROD
ReactDOMForked-profiling.js -0.8% -1.1% 391.65 KB 388.44 KB 72.85 KB 72.07 KB FB_WWW_PROFILING
react-dom-server.browser.development.js 0.0% 0.0% 144.73 KB 144.73 KB 36.77 KB 36.77 KB UMD_DEV
react-dom-server.node.production.min.js 0.0% 0.0% 20.66 KB 20.66 KB 7.65 KB 7.65 KB NODE_PROD
react-dom-test-utils.production.min.js 🔺+6.4% 🔺+5.8% 12.83 KB 13.66 KB 5.02 KB 5.31 KB UMD_PROD
ReactDOMTesting-dev.js -0.0% -0.0% 907.75 KB 907.73 KB 204.77 KB 204.77 KB FB_WWW_DEV
react-dom-test-utils.development.js +8.6% +6.3% 59.93 KB 65.06 KB 17.52 KB 18.63 KB NODE_DEV
ReactDOMTesting-prod.js -0.0% -0.0% 371.87 KB 371.85 KB 70.21 KB 70.18 KB FB_WWW_PROD
react-dom-test-utils.production.min.js 🔺+7.1% 🔺+5.8% 12.69 KB 13.59 KB 4.94 KB 5.22 KB NODE_PROD
react-dom-unstable-fizz.node.production.min.js 0.0% 🔺+0.2% 1.17 KB 1.17 KB 665 B 666 B NODE_PROD
ReactTestUtils-dev.js +10.1% +7.9% 54.31 KB 59.79 KB 15.37 KB 16.58 KB FB_WWW_DEV
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 4.78 KB 4.78 KB 1.68 KB 1.68 KB NODE_DEV
react-dom.development.js -0.6% -0.8% 955.92 KB 949.93 KB 210.13 KB 208.51 KB UMD_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% -0.2% 1.01 KB 1.01 KB 616 B 615 B NODE_PROD
react-dom.production.min.js -0.9% -1.2% 123.04 KB 121.99 KB 40.54 KB 40.07 KB UMD_PROD
react-dom.profiling.min.js -0.8% -1.2% 128.3 KB 127.24 KB 42.22 KB 41.74 KB UMD_PROFILING
ReactDOMForked-dev.js -0.6% -0.8% 963.75 KB 957.63 KB 215.29 KB 213.65 KB FB_WWW_DEV
react-dom.profiling.min.js -0.8% -1.2% 128.66 KB 127.6 KB 41.48 KB 40.98 KB NODE_PROFILING
ReactDOM-dev.js -0.6% -0.8% 963.12 KB 957 KB 215.79 KB 214.17 KB FB_WWW_DEV
ReactDOM-prod.js -0.9% -1.1% 377.78 KB 374.57 KB 70.17 KB 69.39 KB FB_WWW_PROD
ReactDOM-profiling.js -0.8% -1.1% 390.94 KB 387.72 KB 72.62 KB 71.83 KB FB_WWW_PROFILING
ReactDOMServer-dev.js 0.0% 0.0% 141.59 KB 141.59 KB 36.3 KB 36.3 KB FB_WWW_DEV
ReactDOMServer-prod.js 0.0% -0.0% 46.44 KB 46.44 KB 10.83 KB 10.83 KB FB_WWW_PROD
react-dom-test-utils.development.js +8.3% +6.1% 64.85 KB 70.22 KB 18.02 KB 19.12 KB UMD_DEV

ReactDOM: size: 🔺+6.4%, gzip: 🔺+5.8%

Size changes (experimental)

Generated by 🚫 dangerJS against 62105de

@sizebot
Copy link

sizebot commented Sep 14, 2020

Details of bundled changes.

Comparing: ec39a5e...62105de

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js -0.7% -0.8% 874.22 KB 868.53 KB 200.96 KB 199.4 KB NODE_DEV
ReactDOMForked-prod.js -0.8% -1.1% 389.47 KB 386.26 KB 72.11 KB 71.32 KB FB_WWW_PROD
react-dom.production.min.js -0.9% -1.3% 118.66 KB 117.6 KB 38.5 KB 38 KB NODE_PROD
ReactDOMForked-profiling.js -0.8% -1.1% 402.96 KB 399.74 KB 74.6 KB 73.8 KB FB_WWW_PROFILING
react-dom-server.browser.development.js 0.0% 0.0% 143.14 KB 143.14 KB 36.57 KB 36.57 KB UMD_DEV
react-dom-test-utils.production.min.js 🔺+6.4% 🔺+5.8% 12.82 KB 13.65 KB 5.01 KB 5.31 KB UMD_PROD
ReactDOMTesting-dev.js -0.0% -0.0% 936.08 KB 936.07 KB 210.21 KB 210.21 KB FB_WWW_DEV
react-dom-test-utils.development.js +8.6% +6.3% 59.92 KB 65.05 KB 17.51 KB 18.62 KB NODE_DEV
ReactDOMTesting-prod.js -0.0% -0.0% 384.93 KB 384.92 KB 72.37 KB 72.36 KB FB_WWW_PROD
react-dom-test-utils.production.min.js 🔺+7.1% 🔺+5.8% 12.68 KB 13.58 KB 4.93 KB 5.21 KB NODE_PROD
ReactTestUtils-dev.js +10.1% +7.9% 54.31 KB 59.79 KB 15.36 KB 16.57 KB FB_WWW_DEV
react-dom.development.js -0.7% -0.8% 918.72 KB 912.73 KB 203.52 KB 201.94 KB UMD_DEV
react-dom.production.min.js -0.9% -1.3% 118.55 KB 117.49 KB 39.19 KB 38.69 KB UMD_PROD
react-dom.profiling.min.js -0.9% -1.1% 122.45 KB 121.39 KB 40.36 KB 39.9 KB UMD_PROFILING
ReactDOMForked-dev.js -0.6% -0.7% 989.33 KB 983.21 KB 219.99 KB 218.36 KB FB_WWW_DEV
react-dom.profiling.min.js -0.9% -1.3% 122.73 KB 121.67 KB 39.69 KB 39.19 KB NODE_PROFILING
react-dom-server.browser.production.min.js 0.0% -0.0% 19.88 KB 19.88 KB 7.46 KB 7.46 KB UMD_PROD
ReactDOM-dev.js -0.6% -0.7% 988.7 KB 982.58 KB 220.44 KB 218.83 KB FB_WWW_DEV
ReactDOM-prod.js -0.8% -1.1% 389.04 KB 385.82 KB 71.9 KB 71.1 KB FB_WWW_PROD
react-dom-server.browser.development.js 0.0% 0.0% 135.79 KB 135.79 KB 36.12 KB 36.12 KB NODE_DEV
ReactDOM-profiling.js -0.8% -1.1% 402.24 KB 399.03 KB 74.33 KB 73.53 KB FB_WWW_PROFILING
ReactDOMServer-dev.js 0.0% 0.0% 145.62 KB 145.62 KB 37.31 KB 37.31 KB FB_WWW_DEV
ReactDOMServer-prod.js 0.0% -0.0% 47.3 KB 47.3 KB 11.04 KB 11.04 KB FB_WWW_PROD
react-dom-test-utils.development.js +8.3% +6.1% 64.84 KB 70.21 KB 18.01 KB 19.11 KB UMD_DEV

ReactDOM: size: 🔺+6.4%, gzip: 🔺+5.8%

Size changes (stable)

Generated by 🚫 dangerJS against 62105de

@acdlite
Copy link
Collaborator Author

acdlite commented Sep 14, 2020

Confirmed this fixes the size regression.

sizebot comment is misleading :D TestUtils bundle increased (as expected), but the React DOM bundle size decreased.

Screen Shot 2020-09-14 at 12 00 20 PM

@acdlite acdlite marked this pull request as ready for review September 14, 2020 17:02
Copy link
Collaborator

@gaearon gaearon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

¯\(ツ)

@acdlite acdlite merged commit b93f3e7 into facebook:master Sep 14, 2020
todortotev pushed a commit to todortotev/react that referenced this pull request Sep 18, 2020
Adds back the `TestUtils.act` implementation that I had removed
in facebook#19745. This version of `act` is implemented in "userspace" (i.e. not
the reconciler), so it doesn't add to the production bundle size.

I had removed this in facebook#19745 in favor of the `act` exported by the
reconciler because I thought we would remove support for `act` in
production in the impending major release. (It currently warns.)

However, we've since decided to continue supporting `act` in prod for
now, so that it doesn't block people from upgrading to v17. We'll drop
support in a future major release.

So, to avoid bloating the production bundle size, we need to move the
public version of `act` back to "userspace", like it was before.

This doesn't negate the main goal of facebook#19745, though, which was to
decouple the public version(s) of `act` from the internal one that we
use to test React itself.
koto pushed a commit to koto/react that referenced this pull request Jun 15, 2021
Adds back the `TestUtils.act` implementation that I had removed
in facebook#19745. This version of `act` is implemented in "userspace" (i.e. not
the reconciler), so it doesn't add to the production bundle size.

I had removed this in facebook#19745 in favor of the `act` exported by the
reconciler because I thought we would remove support for `act` in
production in the impending major release. (It currently warns.)

However, we've since decided to continue supporting `act` in prod for
now, so that it doesn't block people from upgrading to v17. We'll drop
support in a future major release.

So, to avoid bloating the production bundle size, we need to move the
public version of `act` back to "userspace", like it was before.

This doesn't negate the main goal of facebook#19745, though, which was to
decouple the public version(s) of `act` from the internal one that we
use to test React itself.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants