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

Remove _resetEventPlugins, use jest.resetModuleRegistry #9111

Merged
merged 2 commits into from
Mar 7, 2017

Conversation

aweary
Copy link
Contributor

@aweary aweary commented Mar 4, 2017

This isn't called at runtime and is only used in internal unit tests. Despite that, it's currently being included in production builds. This change makes it so only exists DEV removes it and uses jest.resetModuleRegistry in its place.

We might even want to go a step further and define it in our test suite instead since it serves no purpose in DEV either. If that's acceptable, I can update the PR with that approach which seems preferable.

   raw     gz Compared to last run
  +115    +28 build/react-dom-fiber.js
  -243    -50 build/react-dom-fiber.min.js
  +115    +29 build/react-dom-server.js
  -242    -45 build/react-dom-server.min.js
  +115    +29 build/react-dom.js
  -242    -53 build/react-dom.min.js
     =      = build/react-with-addons.js
     =      = build/react-with-addons.min.js
     =      = build/react.js
     =      = build/react.min.js

@gaearon
Copy link
Collaborator

gaearon commented Mar 4, 2017

I don’t think moving it to unit tests would work since they'd have to depend on internals even more.
Let's keep it gated by DEV.

By the way, why is there a DEV block inside of it?

@aweary
Copy link
Contributor Author

aweary commented Mar 5, 2017

By the way, why is there a DEV block inside of it?

🤷‍♂️ no clue, that was the existing implementation. I'll remove that too.

@aweary aweary force-pushed the move-reset-events-plugin-to-dev branch from 9763ceb to eb91176 Compare March 5, 2017 07:35
@sophiebits
Copy link
Collaborator

Can we change the test to use jest.resetModuleRegistry() instead?

This is not called during runtime at all and is only using in internal unit tests. Despite that, its currently being included in production builds. This change makes it so its only defined in DEV, which might even be too much (we can maybe inject it in our unit tests to avoid defining it at all in EventPluginRegistry)
@aweary aweary force-pushed the move-reset-events-plugin-to-dev branch 2 times, most recently from 9759972 to adf435b Compare March 6, 2017 15:24
@aweary aweary force-pushed the move-reset-events-plugin-to-dev branch from 9759972 to 73e4f86 Compare March 6, 2017 15:27
@aweary
Copy link
Contributor Author

aweary commented Mar 6, 2017

@spicyj good call, I've updated the PR to just remove _resetEventsPlugin altogether and use jest.resetModuleRegistry

@aweary aweary changed the title Make EventPluginRegistry._resetEventPlugins DEV only Remove _resetEventPlugins, use jest.resetModuleRegistry Mar 6, 2017
@gaearon gaearon merged commit 6ca2140 into facebook:master Mar 7, 2017
@gaearon
Copy link
Collaborator

gaearon commented Mar 7, 2017

Thanks!

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