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

Warning: unmountComponentAtNode(): The node you're attempting to unmount was rendered by another copy of React. #732

Closed
1 of 4 tasks
zacharyw opened this issue Jun 2, 2017 · 3 comments

Comments

@zacharyw
Copy link

zacharyw commented Jun 2, 2017

Help us help you! Please choose one:

  • My app crashes with react-rails, so I've included the stack trace and the exact steps which make it crash.
  • My app doesn't crash, but I'm getting unexpected behavior. So, I've described the unexpected behavior and suggested a new behavior.
  • I'm trying to use react-rails with another library, but I'm having trouble. I've described my JavaScript management setup (eg, Sprockets, Webpack...), how I'm trying to use this other library, and why it's not working.
  • I have another issue to discuss.

There was a previous issue (#607) where Turbolinks was causing multiple copies of react to be loaded.

This has since been fixed, but in the latest version of react-rails (v2.2.0) and using the latest webpacker gem (v2.0) I am again seeing the same warning message:

Warning: unmountComponentAtNode(): The node you're attempting to unmount was rendered by another copy of React.

I have tried turning Turbolinks caching off, but that did not resolve the issue. The issue occurs when navigating to a page with a react component from a page with a react component, then back to the original page with the original component.

I have a project and branch example where this is occurring:
https://github.com/zacharyw/rcg/tree/enchancement/es6

To reproduce locally you'll need to log in and post a message from the main index page. Doing this will create a "conversation" by adding a conversation component to a list component. Clicking into that conversation, then back to the home page, then back into the conversation will trigger the warning.

Edit: Moving my pack that sets up ReactRailsUJS into the <head> fixed this. I'm not sure if that's supposed to be required or not. If it is then this issue can be closed, and maybe we can add something to the docs about that requirement.

@rmosolgo
Copy link
Member

rmosolgo commented Jun 3, 2017

Thanks for the great bug report and thanks for following up!

I don't know why this is broken, I would like to keep it open until I get a chance to dig in. Do you mind leaving that branch around for a bit?

@zacharyw
Copy link
Author

zacharyw commented Jun 3, 2017

@rmosolgo Sure thing. I had deleted it after moving the script to the head tag, but I just restored the branch and returned it to a state that demo's the warning message.

@alkesh26
Copy link
Collaborator

We have had no updates on this since 2017. Closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants