nikolalsvk / render_async

render_async lets you include pages asynchronously with AJAX
https://rubygems.org/gems/render_async/
MIT License
1.08k stars 75 forks source link

Adding support for Turbolinks 5+ #66

Closed eclemens closed 5 years ago

eclemens commented 6 years ago

Adding support for Turbolins 5+

nikolalsvk commented 6 years ago

Hey @eclemens, thanks for the PR!

Did you try Using with Turbolinks instructions in the README? Is it working for you with those instructions or we need these changes as well? :)

eclemens commented 6 years ago

Yes, I tried it and kind of worked, but it forces the page to fully refresh. This causes the page to load again everything including the CSS, JS files, etc. and breaking Turbolinks' purpose.

My approach works fine using the regular Turbolinks flow and do not requires the page to refresh/reload.

P. D. Thanks for maintaining this project.

nikolalsvk commented 6 years ago

Awesome, thanks for reporting this, I'll expand the README to inform the users!

Also, I'll see to launch your changes ASAP.

eclemens commented 6 years ago

Any progress to merging this pull request?

nikolalsvk commented 5 years ago

@eclemens I'll try to find some time tomorrow or next weekend to test and push this :)

esoubihe commented 5 years ago

Would be nice to have this merged.

nikolalsvk commented 5 years ago

Hey y'all, just released 2.0.1 version with Turbolinks 5+ support => https://rubygems.org/gems/render_async/versions/2.0.1

If you can, try it out, and tell me how it goes 🍺

esoubihe commented 5 years ago

@eclemens @nikolalsvk Strangely this hasn't worked as expected.

Shouldn't the placeholder be hidden when a preview is available? screen recording 2018-12-13 at 05 33 pm

eclemens commented 5 years ago

Hello @ebsalberto

When Turbolinks shows the preview it displays the last content the page had before it unloads, but once the page is grabbed from the server it replaces the preview. The page from the server has the placeholder, so it first displays the placeholder and then render_async runs.

Please let me know it this was what you meant.

esoubihe commented 5 years ago

@eclemens I was under the impression that this PR would prevent the placeholder of showing up when a preview is available. Does that make sense? If you look at the image above, it looks a bit weird showing a preview, then the loader and the new content.