Skip to content

componentDidMount not fired #565

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

Closed
ghost opened this issue Jul 4, 2016 · 6 comments
Closed

componentDidMount not fired #565

ghost opened this issue Jul 4, 2016 · 6 comments

Comments

@ghost
Copy link

ghost commented Jul 4, 2016

My app doesn't crash, but I'm getting unexpected behavior. So, I've described the unexpected behavior and suggested a new behavior.

Hello,

Since I've fixed a prerender issue in #555, componentDidMount is not fired anymore...
I've also added a server_rendering.js file to fix another issue, who is:

  • added to server_renderer_options in application.rb,
  • precompiled in assets.rb

I don't understand where the problem come from, even if I set the prerender to false the componentDidMount is still not fired.

@rmosolgo
Copy link
Member

rmosolgo commented Jul 5, 2016

Wow, so the components do mount on the page, but the function is never called?

I have no idea what it could be, so I just have the normal questions:

  • Are there any errors in the browser console?
  • Can you share the source of a component which doesn't fire componentDidMount on a fresh page load?

@hieuhlc
Copy link

hieuhlc commented Jul 5, 2016

@tchret If you disabled prerender, I assume your component was rendered by Ajax call or something like that (not on first page load). You should add <script>ReactRailsUJS.mountComponents()</script> where you render component and make sure //= require react_ujs exists in application.js. I just faced this issue and get over it. Hope this help!

@ghost ghost closed this as completed Jul 5, 2016
@rmosolgo
Copy link
Member

rmosolgo commented Jul 5, 2016

Did you find a solution??

@ghost
Copy link
Author

ghost commented Jul 5, 2016

@rmosolgo yes, it was a dumb mistake where I was 100% involved...
Sorry for the inconvenience

@rmosolgo
Copy link
Member

rmosolgo commented Jul 5, 2016

no problem, glad you found it!

@coolbueb
Copy link

coolbueb commented May 7, 2017

What was the issue? I've stumbled upon this issue myself and really can't get past it...

This issue was closed.
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