-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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
Refactor DOM plugin system to fewer modules #18025
Refactor DOM plugin system to fewer modules #18025
Conversation
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 98f306c:
|
86d7203
to
0de3d8f
Compare
return null; | ||
} | ||
listener = props[registrationName]; | ||
if (shouldPreventMouseEvent(registrationName, inst.type, props)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a shame that this runs for Fabric and RN too. This is definitely something we should remove once we get to clean up the existing DOM event system.
@@ -282,7 +282,7 @@ to return true:wantsResponderID| | | |||
+ + */ | |||
|
|||
/** | |||
* A note about event ordering in the `EventPluginHub`. | |||
* A note about event ordering in the `EventPluginRegistry`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We inject into the EventPluginRegistry
now, so the comment changes are to reflect that.
This comment has been minimized.
This comment has been minimized.
Clean up comments fix
0de3d8f
to
98f306c
Compare
Details of bundled changes.Comparing: a607ea4...98f306c react-native-renderer
react-dom
ReactDOM: size: -0.1%, gzip: -0.2% Size changes (stable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This PR refactors and cleans up the existing logic around React's DOM event plugin system. This is primiary to make the system somewhat easier to fork and manage as part of the future work and investigation into possibly using React Roots as the delegation nodes rather than using only the
document
. Please note, there should be no logic/functionaly changes from this PR, and all existing code paths should still work.Notably, this PR does the following:
DOMEventPluginSystem
, this is where the bulk of the DOM plugin event system sits. This file should be forkable for future work with relative ease.EventPluginHub
has been removed. Instead the core functions have now moved to their respective renderers instead. This should make it easier to make changes to the DOM event system in the future without impacting other renderers that keep the existing plugin system.getListener
has been added. This function was previously inEventPluginHub
, but now is a single module and exported function, as it is required during the event propagation phase.ReactDOMEventListener
previously had a lot of logic relating to the DOM plugin system. This has now been moved intoDOMEventPluginSystem
.EventPluginHub-test
that was more a test for invalid listeners, so the test has changed name to reflect this better.EventPluginRegistry
rather than theEventPluginHub
.ReactDOMClientInjection
. In future React versions, we might want to remove this module and instead inline the event plugins directly into the event system instead to save bytes and improve runtime performance (RNW currently requires this as of React 16).