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

Using with Turbolinks #52

Open
frederikhors opened this issue Sep 26, 2019 · 7 comments
Open

Using with Turbolinks #52

frederikhors opened this issue Sep 26, 2019 · 7 comments

Comments

@frederikhors
Copy link

I search in these issues for "turbolinks" work and nothing appears.

I wanna using instant.page with Turbolinks (https://github.com/turbolinks/turbolinks).

If I add:

<script src="//instant.page/2.0.0" type="module" defer integrity="sha384-D7B5eODAUd397+f4zNFAVlnDNDtO1ppV8rPnfygILQXhqu3cUndgHvlcJR2Bhig8"></script>

it works just on the first page I load.

What do you suggests to use with Turbolinks?

I can imagine to use some of the event in https://github.com/turbolinks/turbolinks#full-list-of-events, right?

@frederikhors
Copy link
Author

Maybe an InstantPage.start() to call on every turbolinks:load event will be amazing.

What do you think?

@dieulot
Copy link
Member

dieulot commented Oct 4, 2019

I’m planning to release a new version with a mechanism like InstantPage.start() (but by triggering an event instead of doing a function call, so that instant.page can be loaded asynchronously). Maybe that’ll solve it.

@dieulot
Copy link
Member

dieulot commented Oct 12, 2019

I’ve talked privately with @dhh and he said he’s interested in bringing the just-in-time preloading mechanism into Turbolinks. I also plan to make an alternative to Turbolinks that uses them (in fact I already did so with InstantClick, but it lacks good documentation and a bunch of other things, I plan to reboot it). So maybe I won’t make instant.page compatible with Turbolinks in the next version, it will depend on ease of implementation, we shall see.

@vitobotta
Copy link

Hi @dieulot, so it's not possible to use instant.page with turbolinks now? Thanks

@gpakosz
Copy link

gpakosz commented May 10, 2020

Interested in turbolinks + instant.page as well. What does it take to make the two work together?

@phacks
Copy link

phacks commented May 20, 2020

I tried to get InstantPage to work with Rails to no avail, but managed to get InstantClick set up for a pretty similar result. If anybody’s interested in how I wrote a blog post about it: https://dev.to/phacks/the-rocky-road-to-implementing-link-prefetching-in-rails-oo0

@mxkyb
Copy link

mxkyb commented Dec 26, 2020

Why does this not work? instant.pages EventListeners are bound to the document node, so the script shouldn't even need to get reinitialized on changes from turbolinks. And if the script is not at the end of the body it wouldn't be replaced by turbolinks.

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

No branches or pull requests

6 participants