-
Notifications
You must be signed in to change notification settings - Fork 48.8k
ReactDOMEventListener: clean up module #18713
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
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 481e2d7:
|
55f46ed
to
481e2d7
Compare
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.
Accept to unblock but I think the tests can be cleaned up a little more now.
@@ -53,7 +54,11 @@ describe('ChangeEventPlugin', () => { | |||
postMessageCallback(postMessageEvent); | |||
} | |||
}; | |||
jest.resetModules(); | |||
ReactFeatureFlags.enableModernEventSystem = true; |
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.
I think... you don't need this test to be .internal
anymore since the enableModernEventSystem
flag is marked as variant in ReactFeatureFlags.www-dynamic
.
I think you should be able to remove the .internal
suffix on this (and the below test) and just use the new pragma comment:
// @gate enableModernEventSystem
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.
I tried this locally just now, for some reason some tests in files still break with this change. Namely EnterLeave
. To make sure I'm sane, I break the old legacy event system whilst running the change, so I can see if we are using the modern system or the legacy – and it seems we are still using the legacy with // @gate enableModernEventSystem
I'd rather tackle why that might be the case in another PR. :)
This PR tidies up
ReactDOMEventListener
and moves the different event listener approaches into their respective modules. This makes it easier to remove event systems in the future without breaking something else. Along the way, I noticed that we weren't applying the modern event system flag in the plugin tests properly, so this fixes that too.