Skip to content

Turbolinks 5 not showing react components when cache is shown #516

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
1 of 4 tasks
dobrite opened this issue Apr 20, 2016 · 3 comments
Closed
1 of 4 tasks

Turbolinks 5 not showing react components when cache is shown #516

dobrite opened this issue Apr 20, 2016 · 3 comments

Comments

@dobrite
Copy link
Contributor

dobrite commented Apr 20, 2016

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.

I'm working through the process of adding Turbolinks 5 to an app. I am expecting react components to be present while the cache is being shown prior to a fresh copy being retrieved during an application visit. Since react components are unmounted prior to the cache "snapshot" being taken, they are not present in the view.

Changing this event to turbolinks:before-render seems to fix the issue. turbolinks:before-render seems to be the next event fired after turbolinks:before-cache.

React components are now present when the cache shows. This event has no direct translation to turbolinks classic.

If this sounds good I can get a PR going.

Broke

react-rails_broke

Fixed

react-rails_fixed

@rmosolgo
Copy link
Member

👍 Makes sense, I guess I picked the wrong event for that! Please go for it!

@dijonkitchen
Copy link

I think this can be closed now.

@rmosolgo
Copy link
Member

Thanks!

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

Successfully merging a pull request may close this issue.

3 participants