-
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
Invariant Violation when rendering using both ReactDOM and ReactDOMServer #8487
Comments
Thanks for the report @BS-Harou. It looks like its related to |
To be clear it won't crash your code since the error is being caught. But we need to fix it. |
I have a small reproducible example of this bug. I can create an example repo that triggers it if needed. |
It seems my fiddle stopped working for some reason. @captbaritone go ahead :) Edit: Fixed mine in the first post as well. |
@BS-Harou is there any reason you are using ReactDOM.render() twice with same values. I removed one and it solved the warning was removed. |
@mrgurdeep There is. The internal itemMap object gets "damaged" only after both React and ReactDOMServer render methods are used. So only the next render method called after that tries to use the "damaged" itemMap and triggers the warning. Note that I don't think it matters whether the second ReactDOM.render is called with the same data as the first one or not. |
Looks like we have a fix in #9005—going to merge it once it's rebased, and hopefully get it into 15.5. |
It was fixed in 15.5. |
Using both ReactDOM.render and ReactDOMServer.render(\w+) causes an invariant violation in React 15.4.1.
See console on https://jsfiddle.net/martinkadlec/jb7bqg5o/4/
There is:
Notice that I render completely different components with each of the render methods.
Some criteria have to be met for the warning to show, like at least two nested components.
To me it seems like the ReactDOMServer is messing with itemMap in the regular React and the IDs of components doesn't match.
The text was updated successfully, but these errors were encountered: