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

Experimental event API: refactor responder modules for lifecycle inclusion #15322

Merged
merged 5 commits into from
Apr 4, 2019

Conversation

trueadm
Copy link
Contributor

@trueadm trueadm commented Apr 4, 2019

This PR moves around some parts and refactors the event responder system to cater for event responders having new lifecycle events (to be added in a follow up PR). The big difference is that handleEvent -> onEvent and it now has another argument, event.

I had feedback that it was confusing why the context object had so many concerns, so that's been taken care of now – it only deals with the context of the responder dealing with events, the actual event properties are in the event object.

I've also cleaned up and removed all the prototype methods and instead opted for static methods and using closures.

Ref #15257

@sizebot
Copy link

sizebot commented Apr 4, 2019

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

Details of bundled changes.

Comparing: 937d262...7a81cdf

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js -0.1% -0.0% 887.21 KB 886.72 KB 200.4 KB 200.31 KB UMD_DEV
react-dom.production.min.js -0.0% -0.0% 105.59 KB 105.58 KB 34.19 KB 34.19 KB UMD_PROD
react-dom.profiling.min.js -0.0% -0.0% 108.6 KB 108.58 KB 34.79 KB 34.79 KB UMD_PROFILING
react-dom.development.js -0.1% -0.0% 881.82 KB 881.34 KB 198.83 KB 198.74 KB NODE_DEV
react-dom.production.min.js -0.0% -0.0% 105.57 KB 105.56 KB 33.64 KB 33.64 KB NODE_PROD
react-dom.profiling.min.js -0.0% 0.0% 108.69 KB 108.67 KB 34.22 KB 34.23 KB NODE_PROFILING
ReactDOM-dev.js -0.1% -0.0% 907.99 KB 907.52 KB 200.74 KB 200.67 KB FB_WWW_DEV
ReactDOM-prod.js -0.1% -0.1% 333.63 KB 333.43 KB 61.38 KB 61.34 KB FB_WWW_PROD
ReactDOM-profiling.js -0.1% -0.1% 340.31 KB 340.11 KB 62.79 KB 62.74 KB FB_WWW_PROFILING
react-dom-unstable-fire.development.js -0.1% -0.0% 887.53 KB 887.04 KB 200.54 KB 200.44 KB UMD_DEV
react-dom-unstable-fire.production.min.js -0.0% -0.0% 105.6 KB 105.59 KB 34.2 KB 34.19 KB UMD_PROD
react-dom-unstable-fire.profiling.min.js -0.0% -0.0% 108.61 KB 108.6 KB 34.8 KB 34.8 KB UMD_PROFILING
react-dom-unstable-fire.development.js -0.1% -0.0% 882.15 KB 881.66 KB 198.97 KB 198.88 KB NODE_DEV
react-dom-unstable-fire.production.min.js -0.0% -0.0% 105.59 KB 105.57 KB 33.65 KB 33.65 KB NODE_PROD
react-dom-unstable-fire.profiling.min.js -0.0% 0.0% 108.7 KB 108.69 KB 34.23 KB 34.24 KB NODE_PROFILING
ReactFire-dev.js -0.1% -0.0% 907.18 KB 906.7 KB 200.71 KB 200.64 KB FB_WWW_DEV
ReactFire-prod.js -0.1% -0.1% 322.29 KB 322.08 KB 59.05 KB 59 KB FB_WWW_PROD
ReactFire-profiling.js -0.1% -0.1% 328.92 KB 328.71 KB 60.45 KB 60.4 KB FB_WWW_PROFILING
react-dom-unstable-new-scheduler.development.js -0.1% -0.0% 880.41 KB 879.92 KB 198.29 KB 198.2 KB NODE_DEV
react-dom-unstable-new-scheduler.production.min.js -0.0% -0.0% 103.64 KB 103.62 KB 33.08 KB 33.07 KB NODE_PROD
react-dom-unstable-new-scheduler.profiling.min.js -0.0% -0.0% 106.95 KB 106.94 KB 34.05 KB 34.05 KB NODE_PROFILING
ReactDOMNewScheduler-dev.js -0.1% -0.0% 908.02 KB 907.54 KB 200.74 KB 200.67 KB FB_WWW_DEV
ReactDOMNewScheduler-prod.js -0.1% -0.1% 327.87 KB 327.67 KB 60.95 KB 60.91 KB FB_WWW_PROD
ReactDOMNewScheduler-profiling.js -0.1% -0.1% 333.61 KB 333.41 KB 62.04 KB 61.98 KB FB_WWW_PROFILING
react-dom-test-utils.development.js 0.0% -0.0% 52.68 KB 52.68 KB 14.33 KB 14.33 KB UMD_DEV
react-dom-test-utils.production.min.js 0.0% -0.1% 10.52 KB 10.52 KB 3.9 KB 3.89 KB UMD_PROD
react-dom-test-utils.development.js 0.0% -0.0% 52.41 KB 52.41 KB 14.26 KB 14.26 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% -0.1% 10.31 KB 10.31 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.85 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.42 KB 10.42 KB 3.57 KB 3.56 KB NODE_PROD
react-dom-server.browser.development.js 0.0% -0.0% 135.49 KB 135.49 KB 35.62 KB 35.62 KB UMD_DEV
react-dom-server.browser.development.js 0.0% -0.0% 131.62 KB 131.62 KB 34.69 KB 34.69 KB NODE_DEV
ReactDOMServer-dev.js 0.0% -0.0% 133.88 KB 133.88 KB 34.43 KB 34.43 KB FB_WWW_DEV
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.3% 1.05 KB 1.05 KB 638 B 636 B NODE_PROD
react-dom-unstable-fizz.node.development.js 0.0% -0.2% 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.3% 1.1 KB 1.1 KB 668 B 666 B NODE_PROD

react-events

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-events.development.js 0.0% -0.3% 1.16 KB 1.16 KB 618 B 616 B UMD_DEV
react-events.production.min.js 0.0% -0.7% 682 B 682 B 432 B 429 B UMD_PROD
react-events.development.js 0.0% -0.4% 996 B 996 B 556 B 554 B NODE_DEV
react-events.production.min.js 0.0% -0.6% 512 B 512 B 354 B 352 B NODE_PROD
react-events-press.development.js +4.9% +2.7% 10.86 KB 11.39 KB 2.69 KB 2.76 KB UMD_DEV
react-events-press.production.min.js 🔺+5.0% 🔺+2.4% 4.21 KB 4.42 KB 1.53 KB 1.57 KB UMD_PROD
react-events-press.development.js +5.0% +2.7% 10.69 KB 11.22 KB 2.65 KB 2.72 KB NODE_DEV
react-events-press.production.min.js 🔺+5.2% 🔺+2.5% 4.04 KB 4.25 KB 1.48 KB 1.52 KB NODE_PROD
ReactEventsPress-dev.js +5.3% +2.7% 10.9 KB 11.48 KB 2.69 KB 2.76 KB FB_WWW_DEV
ReactEventsPress-prod.js 🔺+5.8% 🔺+2.9% 8.46 KB 8.95 KB 1.92 KB 1.97 KB FB_WWW_PROD
react-events-hover.development.js +0.4% -0.3% 5.24 KB 5.26 KB 1.46 KB 1.46 KB UMD_DEV
react-events-hover.production.min.js -0.8% 0.0% 2.28 KB 2.26 KB 942 B 942 B UMD_PROD
react-events-hover.development.js +0.4% -0.3% 5.07 KB 5.09 KB 1.42 KB 1.42 KB NODE_DEV
react-events-hover.production.min.js -0.9% -0.9% 2.12 KB 2.1 KB 887 B 879 B NODE_PROD
ReactEventsHover-dev.js +0.2% +0.6% 5.06 KB 5.07 KB 1.42 KB 1.43 KB FB_WWW_DEV
ReactEventsHover-prod.js 🔺+1.0% -1.8% 4.19 KB 4.23 KB 1.11 KB 1.09 KB FB_WWW_PROD
react-events-focus.development.js -1.6% -0.4% 3.34 KB 3.29 KB 1.11 KB 1.11 KB UMD_DEV
react-events-focus.production.min.js -2.2% -1.7% 1.55 KB 1.52 KB 750 B 737 B UMD_PROD
react-events-focus.development.js -1.6% -0.5% 3.17 KB 3.12 KB 1.06 KB 1.06 KB NODE_DEV
react-events-focus.production.min.js -2.5% -1.6% 1.38 KB 1.35 KB 680 B 669 B NODE_PROD
ReactEventsFocus-dev.js -3.1% -1.5% 3.13 KB 3.04 KB 1.05 KB 1.03 KB FB_WWW_DEV
ReactEventsFocus-prod.js -6.4% -3.5% 2.52 KB 2.36 KB 838 B 809 B FB_WWW_PROD
react-events-swipe.development.js -0.4% -0.0% 8.31 KB 8.28 KB 2.57 KB 2.57 KB UMD_DEV
react-events-swipe.production.min.js -0.6% -0.4% 3.47 KB 3.45 KB 1.61 KB 1.6 KB UMD_PROD
react-events-swipe.development.js -0.4% 0.0% 8.14 KB 8.11 KB 2.53 KB 2.53 KB NODE_DEV
react-events-swipe.production.min.js -0.6% -0.6% 3.31 KB 3.29 KB 1.56 KB 1.55 KB NODE_PROD
ReactEventsSwipe-dev.js -0.5% 0.0% 6.23 KB 6.2 KB 1.78 KB 1.78 KB FB_WWW_DEV
ReactEventsSwipe-prod.js -0.8% 0.0% 5.97 KB 5.92 KB 1.54 KB 1.54 KB FB_WWW_PROD
react-events-drag.development.js -0.4% -0.1% 7.83 KB 7.8 KB 2.44 KB 2.44 KB UMD_DEV
react-events-drag.production.min.js -0.9% 🔺+0.5% 3.33 KB 3.3 KB 1.5 KB 1.5 KB UMD_PROD
react-events-drag.development.js -0.4% -0.1% 7.67 KB 7.63 KB 2.41 KB 2.4 KB NODE_DEV
react-events-drag.production.min.js -0.9% 🔺+0.1% 3.17 KB 3.14 KB 1.44 KB 1.44 KB NODE_PROD
ReactEventsDrag-dev.js -0.5% +0.1% 5.92 KB 5.89 KB 1.69 KB 1.69 KB FB_WWW_DEV
ReactEventsDrag-prod.js -1.1% 🔺+1.1% 5.47 KB 5.41 KB 1.38 KB 1.39 KB FB_WWW_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

packages/react-dom/src/events/DOMEventResponderSystem.js Outdated Show resolved Hide resolved
@trueadm trueadm merged commit b93a8a9 into facebook:master Apr 4, 2019
@trueadm trueadm deleted the event-component-lifecycle branch April 4, 2019 22:28
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