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

Don't use EventListener Fork in Modern WWW Builds #18333

Merged
merged 2 commits into from
Mar 18, 2020

Conversation

sebmarkbage
Copy link
Collaborator

If D20382065 successfully rolls out (has some issues still). Then we don't need this fork anymore.

We should start by at least removing it from Modern builds.

To do this I needed to fix the unsubscribing stuff mentioned in #18270 (comment). Flare is now used by both the FB fork and without it so we should just compile to one or the other. I do that by always returning an unsubscribe listener and always passing that to a removeEventListener function. The indirections can then be compiled out.

@sebmarkbage sebmarkbage requested review from gaearon and trueadm March 18, 2020 02:01
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Mar 18, 2020
if (passiveBrowserEventsSupported) {
targetContainer.removeEventListener(rawEventName, listener, {
capture,
passive,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The passive flag is not needed when removing. Only the capture flag needs to be specified.

validTargetContainer.removeEventListener(
((rawEventName: any): string),
(listener: any),
);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This wasn't specifying the capture flag but I fixed that.

@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 fdf0b23:

Sandbox Source
zealous-pond-bwb38 Configuration

@sizebot
Copy link

sizebot commented Mar 18, 2020

Details of bundled changes.

Comparing: aae83a4...fdf0b23

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% 136.74 KB 136.74 KB 34.96 KB 34.96 KB UMD_DEV
react-dom.profiling.min.js 0.0% 0.0% 126.46 KB 126.46 KB 39.55 KB 39.55 KB NODE_PROFILING
ReactDOM-dev.js -0.1% -0.0% 937.82 KB 937.35 KB 208.61 KB 208.52 KB FB_WWW_DEV
ReactDOM-prod.js -0.2% -0.2% 384.33 KB 383.69 KB 69.92 KB 69.82 KB FB_WWW_PROD
ReactDOM-profiling.js -0.2% -0.1% 401.92 KB 401.28 KB 72.95 KB 72.85 KB FB_WWW_PROFILING
react-dom-unstable-fizz.browser.development.js 0.0% -0.1% 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.2% 1 KB 1 KB 610 B 609 B NODE_PROD
react-dom-test-utils.production.min.js 0.0% 0.0% 12.27 KB 12.27 KB 4.56 KB 4.56 KB UMD_PROD
ReactDOMTesting-dev.js -0.1% -0.1% 892.77 KB 892.29 KB 199.52 KB 199.42 KB FB_WWW_DEV
ReactDOMTesting-prod.js -0.2% -0.2% 377.57 KB 376.98 KB 69.03 KB 68.92 KB FB_WWW_PROD
react-dom-test-utils.development.js 0.0% 0.0% 54.78 KB 54.78 KB 15.08 KB 15.08 KB NODE_DEV
ReactDOMTesting-profiling.js -0.2% -0.2% 377.57 KB 376.98 KB 69.03 KB 68.92 KB FB_WWW_PROFILING
react-dom-server.browser.development.js 0.0% 0.0% 129.73 KB 129.73 KB 34.53 KB 34.53 KB NODE_DEV
react-dom.development.js -0.0% -0.0% 933.83 KB 933.76 KB 204 KB 203.95 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
react-dom.production.min.js 0.0% 0.0% 122.33 KB 122.33 KB 39.1 KB 39.1 KB UMD_PROD
ReactDOMForked-dev.js -0.1% -0.0% 937.82 KB 937.35 KB 208.61 KB 208.52 KB FB_WWW_DEV
ReactDOMServer-dev.js 0.0% 0.0% 137.51 KB 137.51 KB 35.13 KB 35.13 KB FB_WWW_DEV
react-dom.profiling.min.js 0.0% 0.0% 126.16 KB 126.16 KB 40.36 KB 40.36 KB UMD_PROFILING
ReactDOMForked-prod.js -0.2% -0.2% 384.33 KB 383.69 KB 69.92 KB 69.82 KB FB_WWW_PROD
react-dom.development.js -0.0% -0.0% 888.98 KB 888.91 KB 201.5 KB 201.46 KB NODE_DEV
ReactDOMForked-profiling.js -0.2% -0.1% 401.92 KB 401.28 KB 72.95 KB 72.85 KB FB_WWW_PROFILING
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.production.min.js 0.0% 0.0% 122.48 KB 122.48 KB 38.27 KB 38.27 KB NODE_PROD
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

Size changes (experimental)

Generated by 🚫 dangerJS against fdf0b23

@sizebot
Copy link

sizebot commented Mar 18, 2020

Details of bundled changes.

Comparing: aae83a4...fdf0b23

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom-test-utils.development.js 0.0% 0.0% 59.3 KB 59.3 KB 15.68 KB 15.68 KB UMD_DEV
ReactDOMTesting-profiling.js -0.2% -0.2% 390.99 KB 390.24 KB 71.19 KB 71.05 KB FB_WWW_PROFILING
react-dom-server.browser.production.min.js 0.0% 0.0% 19.88 KB 19.88 KB 7.37 KB 7.37 KB NODE_PROD
react-dom-server.node.development.js 0.0% 0.0% 129.44 KB 129.44 KB 34.56 KB 34.56 KB NODE_DEV
ReactDOMForked-dev.js -0.0% -0.0% 983.7 KB 983.24 KB 218.53 KB 218.49 KB FB_WWW_DEV
ReactDOMForked-prod.js -0.2% -0.2% 410.75 KB 409.85 KB 74.67 KB 74.51 KB FB_WWW_PROD
react-dom.development.js -0.0% -0.0% 903.34 KB 903.27 KB 198.72 KB 198.67 KB UMD_DEV
ReactDOMForked-profiling.js -0.2% -0.2% 428.4 KB 427.5 KB 77.78 KB 77.62 KB FB_WWW_PROFILING
react-dom-server.browser.production.min.js 0.0% 0.0% 19.97 KB 19.97 KB 7.42 KB 7.42 KB UMD_PROD
ReactDOMTesting-dev.js -0.0% -0.0% 919.42 KB 918.96 KB 205.03 KB 205 KB FB_WWW_DEV
react-dom.development.js -0.0% -0.0% 859.77 KB 859.7 KB 196.25 KB 196.21 KB NODE_DEV
ReactDOMTesting-prod.js -0.2% -0.2% 390.99 KB 390.24 KB 71.19 KB 71.05 KB FB_WWW_PROD
react-dom-server.browser.development.js 0.0% 0.0% 128.22 KB 128.22 KB 34.31 KB 34.31 KB NODE_DEV
ReactDOM-dev.js -0.0% -0.0% 983.7 KB 983.24 KB 218.53 KB 218.49 KB FB_WWW_DEV
ReactDOMServer-dev.js 0.0% 0.0% 138.36 KB 138.36 KB 35.27 KB 35.27 KB FB_WWW_DEV
ReactDOM-prod.js -0.2% -0.2% 410.75 KB 409.85 KB 74.67 KB 74.51 KB FB_WWW_PROD
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 2.94 KB 2.94 KB 1.17 KB 1.17 KB NODE_DEV
ReactDOM-profiling.js -0.2% -0.2% 428.4 KB 427.5 KB 77.78 KB 77.62 KB FB_WWW_PROFILING
react-dom-unstable-fizz.browser.production.min.js 0.0% -0.2% 1013 B 1013 B 602 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.48 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

Size changes (stable)

Generated by 🚫 dangerJS against fdf0b23

Copy link
Contributor

@trueadm trueadm left a comment

Choose a reason for hiding this comment

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

Thanks for doing this. It looks great to me.

@@ -259,20 +250,9 @@ export function removeTrappedEventListener(
capture: boolean,
listener: any => void,
passive: void | boolean,
Copy link
Contributor

@trueadm trueadm Mar 18, 2020

Choose a reason for hiding this comment

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

This argument is not used anymore, I'll address in #18336.

@trueadm
Copy link
Contributor

trueadm commented Mar 18, 2020

I'm merging this as it feeds into #18336. :)

@trueadm trueadm merged commit 94505b9 into facebook:master Mar 18, 2020
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.

4 participants