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

React Event System: cleanup plugins + break out update batching logic #18503

Merged
merged 1 commit into from Apr 6, 2020

Conversation

trueadm
Copy link
Contributor

@trueadm trueadm commented Apr 6, 2020

This PR cleans up a bunch of things with the existing plugin event system that should simplify things and also remove some of the indirection that exists when we try to share things between different renderers to keep things DRY but actually ship irrelevant parts of the code with that when we do.

  • When the modern event system flag is enabled we now staticlly inject the event plugin modules – removing the need to recompute the list of plugins dynamically. In the future this will complement ReactDOM: remove unstable-native-dependencies bundle #18483.
  • ReactGenericBatching.js has been forked for ReactDOM. That version is called ReactDOMUpdateBatching.js and contains all the ReactDOM parts, which have been removed from ReactGenericBatching.js.
  • ReactControlledComponent.js has been moved into ReactDOM and has been renamed ReactDOMControlledComponent.js to reflect that no other renderer, but ReactDOM uses it.
  • Updated ReactTestUtils with an inlined version of runEventsInBatch and removed the export from ReactDOM internals.

@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Apr 6, 2020
@trueadm trueadm requested a review from necolas April 6, 2020 11:23
@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 6, 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 5ceb334:

Sandbox Source
romantic-waterfall-2pndr Configuration

@sizebot
Copy link

sizebot commented Apr 6, 2020

Details of bundled changes.

Comparing: fe2cb52...5ceb334

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.production.min.js -0.0% -0.1% 118.77 KB 118.73 KB 37.25 KB 37.22 KB NODE_PROD
react-dom-test-utils.development.js +21.4% +22.7% 61.81 KB 75.03 KB 16.37 KB 20.08 KB UMD_DEV
ReactDOMTesting-profiling.js -0.1% -0.2% 402.71 KB 402.42 KB 72.97 KB 72.81 KB FB_WWW_PROFILING
react-dom-server.browser.production.min.js 0.0% -0.0% 19.46 KB 19.46 KB 7.3 KB 7.3 KB NODE_PROD
react-dom.profiling.min.js -0.0% -0.0% 122.62 KB 122.58 KB 38.39 KB 38.38 KB NODE_PROFILING
react-dom-test-utils.production.min.js 🔺+7.0% 🔺+7.0% 12.36 KB 13.22 KB 4.57 KB 4.89 KB UMD_PROD
react-dom-server.node.production.min.js 0.0% -0.0% 19.87 KB 19.87 KB 7.45 KB 7.44 KB NODE_PROD
ReactDOMForked-dev.js +0.1% -0.1% 993.04 KB 993.79 KB 220.35 KB 220.14 KB FB_WWW_DEV
ReactDOMForked-prod.js 🔺+0.1% -0.0% 418.32 KB 418.78 KB 75.18 KB 75.16 KB FB_WWW_PROD
react-dom-unstable-fizz.node.development.js 0.0% -0.1% 5.08 KB 5.08 KB 1.67 KB 1.67 KB NODE_DEV
react-dom.development.js -0.0% -0.0% 894.83 KB 894.77 KB 196.46 KB 196.45 KB UMD_DEV
ReactDOMForked-profiling.js +0.1% -0.0% 429.2 KB 429.66 KB 77.03 KB 77 KB FB_WWW_PROFILING
react-dom-server.browser.development.js 0.0% -0.0% 133.12 KB 133.12 KB 34.34 KB 34.34 KB UMD_DEV
react-dom-unstable-fizz.node.production.min.js 0.0% 🔺+0.2% 1.16 KB 1.16 KB 658 B 659 B NODE_PROD
react-dom.production.min.js -0.0% -0.1% 118.66 KB 118.6 KB 38 KB 37.98 KB UMD_PROD
react-dom-server.browser.production.min.js 0.0% -0.0% 19.55 KB 19.55 KB 7.33 KB 7.32 KB UMD_PROD
react-dom.profiling.min.js -0.0% -0.1% 122.38 KB 122.32 KB 39.21 KB 39.18 KB UMD_PROFILING
ReactDOMTesting-dev.js -0.0% -0.1% 946.12 KB 946.06 KB 210.56 KB 210.4 KB FB_WWW_DEV
react-dom.development.js -0.0% -0.0% 851.9 KB 851.83 KB 194.1 KB 194.09 KB NODE_DEV
ReactDOMTesting-prod.js -0.1% -0.2% 402.71 KB 402.42 KB 72.97 KB 72.81 KB FB_WWW_PROD
react-dom-server.browser.development.js 0.0% -0.0% 126.27 KB 126.27 KB 33.9 KB 33.9 KB NODE_DEV
ReactDOM-dev.js +0.1% -0.1% 993.04 KB 993.79 KB 220.35 KB 220.14 KB FB_WWW_DEV
ReactDOMServer-dev.js 0.0% -0.0% 136.03 KB 136.03 KB 34.68 KB 34.68 KB FB_WWW_DEV
ReactDOM-prod.js 🔺+0.1% -0.0% 418.32 KB 418.78 KB 75.18 KB 75.16 KB FB_WWW_PROD
react-dom-test-utils.development.js +22.2% +24.5% 57.18 KB 69.88 KB 15.73 KB 19.57 KB NODE_DEV
react-dom-unstable-fizz.browser.development.js 0.0% -0.1% 4.33 KB 4.33 KB 1.51 KB 1.51 KB NODE_DEV
ReactDOM-profiling.js +0.1% -0.0% 429.2 KB 429.66 KB 77.03 KB 77 KB FB_WWW_PROFILING
react-dom-test-utils.production.min.js 🔺+7.2% 🔺+6.7% 12.22 KB 13.09 KB 4.5 KB 4.8 KB NODE_PROD
react-dom-unstable-fizz.browser.production.min.js 0.0% -0.2% 1 KB 1 KB 609 B 608 B NODE_PROD
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.0% 9.98 KB 9.98 KB 3.35 KB 3.35 KB UMD_PROD
ReactTestUtils-dev.js +8.7% +8.8% 59.47 KB 64.67 KB 16.02 KB 17.43 KB FB_WWW_DEV

ReactDOM: size: 🔺+7.0%, gzip: 🔺+7.0%

Size changes (stable)

Generated by 🚫 dangerJS against 5ceb334

@sizebot
Copy link

sizebot commented Apr 6, 2020

Details of bundled changes.

Comparing: fe2cb52...5ceb334

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom-server.browser.development.js 0.0% -0.0% 134.71 KB 134.71 KB 34.54 KB 34.54 KB UMD_DEV
ReactTestUtils-dev.js +8.7% +8.8% 59.47 KB 64.67 KB 16.03 KB 17.43 KB FB_WWW_DEV
react-dom-server.browser.production.min.js 0.0% -0.0% 20.01 KB 20.01 KB 7.41 KB 7.41 KB UMD_PROD
react-dom.profiling.min.js -0.0% -0.1% 126.9 KB 126.86 KB 39.62 KB 39.59 KB NODE_PROFILING
react-dom-unstable-fizz.browser.development.js 0.0% -0.1% 4.82 KB 4.82 KB 1.62 KB 1.62 KB UMD_DEV
ReactDOM-dev.js +0.1% 0.0% 965.16 KB 965.91 KB 214.01 KB 214.1 KB FB_WWW_DEV
ReactDOM-prod.js 🔺+0.1% 🔺+0.1% 405.26 KB 405.72 KB 73.16 KB 73.25 KB FB_WWW_PROD
ReactDOM-profiling.js +0.1% +0.1% 416.08 KB 416.54 KB 74.96 KB 75.06 KB FB_WWW_PROFILING
react-dom-unstable-fizz.browser.development.js 0.0% -0.1% 4.35 KB 4.35 KB 1.52 KB 1.52 KB NODE_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% -0.2% 1.02 KB 1.02 KB 617 B 616 B NODE_PROD
react-dom-test-utils.development.js +21.4% +22.6% 61.82 KB 75.04 KB 16.38 KB 20.09 KB UMD_DEV
react-dom-test-utils.production.min.js 🔺+6.9% 🔺+7.1% 12.37 KB 13.23 KB 4.58 KB 4.9 KB UMD_PROD
ReactDOMTesting-dev.js -0.0% 0.0% 919.57 KB 919.52 KB 204.78 KB 204.79 KB FB_WWW_DEV
ReactDOMTesting-prod.js -0.1% -0.1% 390.73 KB 390.44 KB 71.08 KB 71.01 KB FB_WWW_PROD
react-dom-test-utils.development.js +22.2% +24.4% 57.19 KB 69.89 KB 15.74 KB 19.58 KB NODE_DEV
ReactDOMTesting-profiling.js -0.1% -0.1% 390.73 KB 390.44 KB 71.08 KB 71.01 KB FB_WWW_PROFILING
react-dom-test-utils.production.min.js 🔺+7.1% 🔺+6.7% 12.23 KB 13.1 KB 4.5 KB 4.81 KB NODE_PROD
react-dom-server.node.production.min.js 0.0% -0.0% 20.33 KB 20.33 KB 7.53 KB 7.53 KB NODE_PROD
react-dom-server.browser.production.min.js 0.0% -0.0% 19.92 KB 19.92 KB 7.38 KB 7.38 KB NODE_PROD
react-dom.development.js -0.0% -0.0% 924.66 KB 924.6 KB 201.77 KB 201.76 KB UMD_DEV
react-dom.production.min.js -0.0% -0.1% 122.74 KB 122.68 KB 39.11 KB 39.08 KB UMD_PROD
ReactDOMForked-dev.js +0.1% 0.0% 965.16 KB 965.91 KB 214.01 KB 214.1 KB FB_WWW_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.1% 10 KB 10 KB 3.36 KB 3.36 KB UMD_PROD
react-dom.profiling.min.js -0.0% -0.1% 126.56 KB 126.51 KB 40.37 KB 40.33 KB UMD_PROFILING
ReactDOMForked-prod.js 🔺+0.1% 🔺+0.1% 405.26 KB 405.72 KB 73.16 KB 73.25 KB FB_WWW_PROD
react-dom.development.js -0.0% -0.0% 880.49 KB 880.42 KB 199.32 KB 199.32 KB NODE_DEV
ReactDOMForked-profiling.js +0.1% +0.1% 416.08 KB 416.54 KB 74.96 KB 75.06 KB FB_WWW_PROFILING
react-dom-unstable-fizz.node.development.js 0.0% -0.1% 5.09 KB 5.09 KB 1.68 KB 1.68 KB NODE_DEV
react-dom.production.min.js -0.0% -0.0% 122.92 KB 122.88 KB 38.38 KB 38.36 KB NODE_PROD
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.0% 9.75 KB 9.75 KB 3.25 KB 3.25 KB NODE_PROD

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

Size changes (experimental)

Generated by 🚫 dangerJS against 5ceb334

@gaearon
Copy link
Collaborator

gaearon commented Apr 6, 2020

When the modern event system flag is enabled we now staticlly inject the event plugin modules – removing the need to recompute the list of plugins dynamically. We also no longer inject the ResponderPlugin as it was recently removed. This should remove a chunk of code when the flag is enabled by default.

Where does this happen?

@trueadm
Copy link
Contributor Author

trueadm commented Apr 6, 2020

@gaearon Ah, well spotted. ReactDOMClientInjection.js which I now included.

@trueadm trueadm force-pushed the simplify-plugins branch 2 times, most recently from 3502039 to d4b691f Compare April 6, 2020 16:00
Include changes

Fix bunch of issues

Cleanup

Fix
@necolas
Copy link
Contributor

necolas commented Apr 6, 2020

We also no longer inject the ResponderPlugin as it was recently removed.

What are you saying here? This plugin wasn't injected by react-dom before and hasn't been removed either.

@trueadm
Copy link
Contributor Author

trueadm commented Apr 6, 2020

What are you saying here? This plugin wasn't injected by react-dom before and hasn't been removed either.

Ah, I thought #18483 was merged already. I've updated the summary.

@trueadm trueadm merged commit a387566 into facebook:master Apr 6, 2020
@trueadm trueadm deleted the simplify-plugins branch April 6, 2020 21:01
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.

None yet

5 participants