-
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
Expose less internals for TestUtils #13539
Conversation
@@ -739,14 +739,19 @@ const ReactDOM: Object = { | |||
unstable_flushControlled: DOMRenderer.flushControlled, | |||
|
|||
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: { | |||
// For TapEventPlugin which is popular in open source | |||
EventPluginHub, |
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.
Technically this was used by TapEventPlugin. But it's already broken with 16.4 and has been deprecated: https://github.com/zilverline/react-tap-event-plugin#deprecated. So this doesn't matter in practice.
I'll check what's up with our www version but last time I looked at it, there were 5 or so callsites left.
dispatchEvent, | ||
runEventsInBatch, | ||
// eslint-disable-next-line no-unused-vars | ||
getFiberCurrentPropsFromNode, |
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 to make this just ,
but Prettier kept moving my comment so I left it in.
@@ -450,19 +453,6 @@ function buildSimulators() { | |||
} | |||
} | |||
|
|||
// Rebuild ReactTestUtils.Simulate whenever event plugins are injected |
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.
Don't need this because we removed injection.
ReactDOMEventListener, | ||
// Keep in sync with ReactDOMUnstableNativeDependencies.js | ||
// and ReactTestUtils.js: | ||
Events: [ |
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 could've made the whole thing an array, but our FB bundle puts some additional exports here. We'll need to come back to them and clean them up too.
ReactDOM: size: -1.3%, gzip: -1.0% Details of bundled changes.Comparing: 28b9289...a691a94 react-dom
react-scheduler
Generated by 🚫 dangerJS |
ReactDOMComponentTree, | ||
ReactDOMEventListener, | ||
// Keep in sync with ReactDOMUnstableNativeDependencies.js | ||
// and ReactTestUtils.js: |
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 we could use Flow to type the Array below to keep these two files in sync for us, e.g.:
Events: [Foo, Bar, Baz] = [ ... ]
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.
Not sure how many of these methods are typed but we can try.
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.
That still wouldn’t help if two methods have the same signature but you mess up their order. So I’m not sure it’s that helpful. And if you need to be careful anyway then maybe it’s okay to keep as is.
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.
True, it wouldn't be perfect, but even if all the types were the same– it would warn if we added/removed an arg one place and not the other.
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.
As discussed, I tried this but some of those are untyped, and it seemed like more work than it's worth
Hi. Someone reported that this broke React Native for Web, which relies on |
Hmm. I thought that everything RNW depends on hangs off the ReactDOMUnstableNativeDependencies entry point. I’m happy to add more stuff to that entry point, but RNW shouldn’t read anything from main secret exports. |
Sure, I don't mind where it's made available. Last time there were changes this is where y'all put it. If you can add it to ReactDOMUnstableNativeDependencies and put that out in a patch, that would be great |
Created a new issue to track this bug #13589 |
EventPluginHub injectComponentTree was exposed for react-native-web, but wasn't actually being used by the project. They were using EventPluginHub through ReactDOM's secret internals, but that was removed in facebook#13539 This removes the unused injectComponentTree export, refactors the ResponderEventPlugin test so it doesn't depend on it, and also adds EventPluginHub to the exports to unbreak react-native-web
…ntPluginHub (#13598) * Remove injectComponentTree from unstable-native-dependencies, add EventPluginHub injectComponentTree was exposed for react-native-web, but wasn't actually being used by the project. They were using EventPluginHub through ReactDOM's secret internals, but that was removed in #13539 This removes the unused injectComponentTree export, refactors the ResponderEventPlugin test so it doesn't depend on it, and also adds EventPluginHub to the exports to unbreak react-native-web * Re-export injectEventPluginsByName from ReactDOM internals
…ntPluginHub (facebook#13598) * Remove injectComponentTree from unstable-native-dependencies, add EventPluginHub injectComponentTree was exposed for react-native-web, but wasn't actually being used by the project. They were using EventPluginHub through ReactDOM's secret internals, but that was removed in facebook#13539 This removes the unused injectComponentTree export, refactors the ResponderEventPlugin test so it doesn't depend on it, and also adds EventPluginHub to the exports to unbreak react-native-web * Re-export injectEventPluginsByName from ReactDOM internals
* Expose less internals for TestUtils * Keep EventPluginHub for www * Reorder to simplify
…ntPluginHub (facebook#13598) * Remove injectComponentTree from unstable-native-dependencies, add EventPluginHub injectComponentTree was exposed for react-native-web, but wasn't actually being used by the project. They were using EventPluginHub through ReactDOM's secret internals, but that was removed in facebook#13539 This removes the unused injectComponentTree export, refactors the ResponderEventPlugin test so it doesn't depend on it, and also adds EventPluginHub to the exports to unbreak react-native-web * Re-export injectEventPluginsByName from ReactDOM internals
… react-native@0.59.10 for [Expose less internals for TestUtils](facebook/react#13539)
This makes internal exports more targeted. Using an array should minify better because we don't create intermediate objects for modules, and can crush function names. These internals should only be used by TestUtils and UnstableNativeDependencies, I've updated both.
ReactDOMFB
if necessary.