Split ReactNoop into normal and persistent exports#12793
Merged
gaearon merged 3 commits intofacebook:masterfrom May 14, 2018
Merged
Split ReactNoop into normal and persistent exports#12793gaearon merged 3 commits intofacebook:masterfrom
gaearon merged 3 commits intofacebook:masterfrom
Conversation
15 tasks
Details of bundled changes.Comparing: 4b2e65d...c26dba7 react-noop-renderer
Generated by 🚫 dangerJS |
sebmarkbage
approved these changes
May 14, 2018
|
|
||
| import ReactNoopShared from './ReactNoopShared'; | ||
|
|
||
| const ReactNoopPersistent = ReactNoopShared( |
Contributor
There was a problem hiding this comment.
Are you going to swap this out or keep the instantiation mechanism?
Collaborator
Author
There was a problem hiding this comment.
I want to keep instantiation. I think it works fine and in this case I don’t see downsides (we don’t plan to make this one inlined).
| @@ -0,0 +1,582 @@ | |||
| /** | |||
Contributor
There was a problem hiding this comment.
For some reason I'm not a big fan of "Shared" as a name. It's like utils. Doesn't say anything. Don't really know where this is going yet so hard to find a better name.
Collaborator
Author
There was a problem hiding this comment.
I can make it createReactNoop. No plans to do anything else with it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This complements #12791 although doesn't depend on it.
While working on #12792 I realized that we call
ReactFiberReconciler()twice in the same file (ReactNoop), once with a mutating and once with a persistent mode.If we make the host config resolved through imports, we can't change what one copy "sees" without changing what another copy "sees" unless we reset modules in the middle. That's what I do with ReactDOM and ReactART in #12792, but I can't
resetModulesbetween twoReactFiberReconciler()calls inReactNoopbecause they don't happen inside the test—they happen inReactNoopitself.With this change, we clearly separate
react-noopandreact-noop/persistent, can remove the awkwardrenderToPersistentRootWithIDmethod in favor of normal render, and avoid the problem.Note: this change isn't necessary because we want to inline ReactNoop host config itself (actually I want the opposite: to keep using it for testing the custom renderer infra). But it is necessary because
ReactPersistent-testwon't work in a world where the reconciler modules import host config from a file because we don't get a chance to change what this file points to midway while executingReactNoop. In practice we don't even use mutating and persistent versions ofReactNoopin the same test file even once.