Skip to content

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

Merged
merged 1 commit into from
Apr 23, 2020

Conversation

trueadm
Copy link
Contributor

@trueadm trueadm commented Apr 23, 2020

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.

@trueadm trueadm requested a review from gaearon April 23, 2020 11:14
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Apr 23, 2020
@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 23, 2020

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:

Sandbox Source
boring-jackson-bmcxz Configuration

@trueadm trueadm force-pushed the clear-up-event-listener branch from 55f46ed to 481e2d7 Compare April 23, 2020 11:21
@sizebot
Copy link

sizebot commented Apr 23, 2020

Warnings
⚠️ Could not find build artifacts for base commit: ff431b7

Size changes (experimental)

Generated by 🚫 dangerJS against 481e2d7

@sizebot
Copy link

sizebot commented Apr 23, 2020

Warnings
⚠️ Could not find build artifacts for base commit: ff431b7

Size changes (stable)

Generated by 🚫 dangerJS against 481e2d7

@trueadm trueadm requested review from sebmarkbage and bvaughn April 23, 2020 15:52
Copy link
Contributor

@bvaughn bvaughn left a 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;
Copy link
Contributor

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

Copy link
Contributor Author

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. :)

@trueadm trueadm merged commit 4e3545f into facebook:master Apr 23, 2020
@trueadm trueadm deleted the clear-up-event-listener branch April 24, 2020 11:42
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