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

Event API: use capture for all event listeners using experimental responder system #15526

Merged
merged 6 commits into from
Apr 30, 2019

Conversation

trueadm
Copy link
Contributor

@trueadm trueadm commented Apr 29, 2019

This PR makes all experimental event API listeners use the capture phase of event listening. Given that the experimental event API is fully virtualized, we can dispatch capture and bubble events using the event system, rather than using the DOM propagation system. Not only does this give us much greater control over what gets dispatched and how it gets dispatched, it also allows us to traverse through portals and other abstract concepts. Furthermore, by being in the capture phase, we are sure to get the event before other event listeners – meaning they are unlikely to stopImmediatePropgation on React. Note: event components are not affected by this change – they can still dispatch capture and bubble events back to the user.

This remove a whole lot of code. I'll add follow up tests in the comings days, unless @necolas has bandwidth to do that earlier.

@trueadm trueadm requested a review from necolas April 29, 2019 13:14
@trueadm trueadm changed the title Event API: fallback correctly registers DOM listener [WIP] Event API: use capture for all event listeners using experimental responder system Apr 29, 2019
@trueadm trueadm changed the title [WIP] Event API: use capture for all event listeners using experimental responder system Event API: use capture for all event listeners using experimental responder system Apr 29, 2019
@sizebot
Copy link

sizebot commented Apr 29, 2019

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

Details of bundled changes.

Comparing: cc5a493...329292a

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js -0.1% -0.1% 819.43 KB 818.73 KB 186.62 KB 186.51 KB UMD_DEV
react-dom.production.min.js 0.0% -0.0% 103.68 KB 103.68 KB 33.69 KB 33.69 KB UMD_PROD
react-dom.profiling.min.js 0.0% -0.0% 106.83 KB 106.83 KB 34.67 KB 34.67 KB UMD_PROFILING
react-dom.development.js -0.1% -0.1% 813.91 KB 813.21 KB 185.08 KB 184.96 KB NODE_DEV
react-dom.production.min.js 0.0% -0.0% 103.67 KB 103.67 KB 33.14 KB 33.14 KB NODE_PROD
react-dom.profiling.min.js 0.0% -0.0% 107 KB 107 KB 33.98 KB 33.98 KB NODE_PROFILING
ReactDOM-dev.js -0.1% -0.1% 838.3 KB 837.53 KB 186.53 KB 186.37 KB FB_WWW_DEV
ReactDOM-prod.js -0.1% -0.1% 344.8 KB 344.34 KB 63.78 KB 63.7 KB FB_WWW_PROD
ReactDOM-profiling.js -0.1% -0.1% 350.24 KB 349.78 KB 64.78 KB 64.71 KB FB_WWW_PROFILING
react-dom-unstable-fire.development.js -0.1% -0.1% 819.75 KB 819.06 KB 186.75 KB 186.64 KB UMD_DEV
react-dom-unstable-fire.production.min.js 0.0% -0.0% 103.69 KB 103.69 KB 33.7 KB 33.7 KB UMD_PROD
react-dom-unstable-fire.profiling.min.js 0.0% -0.0% 106.84 KB 106.84 KB 34.68 KB 34.68 KB UMD_PROFILING
react-dom-unstable-fire.development.js -0.1% -0.1% 814.23 KB 813.54 KB 185.21 KB 185.09 KB NODE_DEV
react-dom-unstable-fire.production.min.js 0.0% -0.0% 103.69 KB 103.69 KB 33.15 KB 33.14 KB NODE_PROD
react-dom-unstable-fire.profiling.min.js 0.0% -0.0% 107.01 KB 107.01 KB 33.99 KB 33.99 KB NODE_PROFILING
ReactFire-dev.js -0.1% -0.1% 837.49 KB 836.72 KB 186.52 KB 186.37 KB FB_WWW_DEV
ReactFire-prod.js -0.1% -0.1% 332.79 KB 332.33 KB 61.37 KB 61.3 KB FB_WWW_PROD
ReactFire-profiling.js -0.1% -0.1% 338.2 KB 337.74 KB 62.35 KB 62.28 KB FB_WWW_PROFILING
react-dom-test-utils.development.js 0.0% -0.0% 54.23 KB 54.23 KB 14.98 KB 14.98 KB UMD_DEV
react-dom-test-utils.production.min.js 0.0% -0.1% 10.56 KB 10.56 KB 3.9 KB 3.89 KB UMD_PROD
react-dom-test-utils.development.js 0.0% -0.0% 53.95 KB 53.95 KB 14.91 KB 14.91 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% -0.0% 10.35 KB 10.35 KB 3.82 KB 3.82 KB NODE_PROD
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 60.76 KB 60.76 KB 15.85 KB 15.84 KB UMD_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.1% 10.69 KB 10.69 KB 3.67 KB 3.66 KB UMD_PROD
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 60.43 KB 60.43 KB 15.72 KB 15.72 KB NODE_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.1% 10.43 KB 10.43 KB 3.57 KB 3.56 KB NODE_PROD
react-dom-server.browser.development.js 0.0% -0.0% 136.5 KB 136.5 KB 35.93 KB 35.93 KB UMD_DEV
react-dom-server.browser.production.min.js 0.0% -0.0% 19.12 KB 19.12 KB 7.21 KB 7.21 KB UMD_PROD
react-dom-server.browser.development.js 0.0% -0.0% 132.63 KB 132.63 KB 34.99 KB 34.99 KB NODE_DEV
react-dom-server.browser.production.min.js 0.0% -0.0% 19.04 KB 19.04 KB 7.2 KB 7.2 KB NODE_PROD
ReactDOMServer-dev.js 0.0% -0.0% 134.79 KB 134.79 KB 34.63 KB 34.63 KB FB_WWW_DEV
ReactDOMServer-prod.js 0.0% -0.0% 46.91 KB 46.91 KB 10.77 KB 10.77 KB FB_WWW_PROD
react-dom-server.node.development.js 0.0% -0.0% 134.57 KB 134.57 KB 35.54 KB 35.54 KB NODE_DEV
react-dom-server.node.production.min.js 0.0% -0.0% 19.91 KB 19.91 KB 7.5 KB 7.5 KB NODE_PROD
react-dom-unstable-fizz.browser.development.js 0.0% -0.1% 3.66 KB 3.66 KB 1.45 KB 1.45 KB UMD_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% -0.1% 1.21 KB 1.21 KB 706 B 705 B UMD_PROD
react-dom-unstable-fizz.browser.development.js 0.0% -0.1% 3.49 KB 3.49 KB 1.41 KB 1.41 KB NODE_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% -0.2% 1.05 KB 1.05 KB 637 B 636 B NODE_PROD
react-dom-unstable-fizz.node.development.js 0.0% -0.1% 3.74 KB 3.74 KB 1.43 KB 1.43 KB NODE_DEV
react-dom-unstable-fizz.node.production.min.js 0.0% -0.1% 1.1 KB 1.1 KB 667 B 666 B NODE_PROD

Generated by 🚫 dangerJS

Copy link
Contributor

@necolas necolas left a comment

Choose a reason for hiding this comment

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

lgtm, just a flow type needs updating. probably worth checking the sandbox experience too

@trueadm trueadm merged commit bd88982 into facebook:master Apr 30, 2019
@trueadm trueadm deleted the fallback-event-listener branch April 30, 2019 10:40
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.

4 participants