-
Notifications
You must be signed in to change notification settings - Fork 407
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 Turbo Drive with data-turbo-track="reload" causes the destination page to be rendered twice #114
Comments
Same problem here, and this is a bit more important as I have a button that "generates a data" and the data gets generated twice (because the request is made twice). If I remove the turbo-track from the second script, I don't have the problem anymore but the JS doesn't load. And... I would prefer to keep packs separated. Any advice? ^^' |
I temporarily use meta tag to load page js(trigger page reload) <% content_for :head_additions do %>
<meta name="turbo-visit-control" content="reload">
<%= javascript_pack_tag "page_specific_js" %>
<% end %> |
That is actually a nice catch! |
We're experiencing the same issue. In our app we're gradually migrating to a new layout, which uses different assets. If we submit the form on a page with the old layout, and that form redirects to a page with a new layout, the flash message set for the redirect will not appear on the final page. I guess we could work around this by temporarily disabling Turbo for those form submits that go between layouts, until we finish the migration. |
I think I'm experiencing this, in a slightly different scenario...
Any work arounds to prevent this double-pump? |
1 year later and this issue still not resolved :/ @seanpdoyle just curious... any reason why page reload is required? why not just create a script element and replace the old one? (isn't the hash string appended to the file's-name sufficient to for the browser to renew the cache?) I will try to find a solution if I can. |
My Rails app has two layouts:
auth
(sign up, sign in, password reset, ...)admin
(the app itself)Both layouts also have their own asset packs, each marked with
data-turbo-track="reload"
. The switch of layout happens after signing in or signing out. Because of the reload, the page is rendered twice. Once asTURBO_STREAM
and a second time asHTML
:Generally, that's not too big of an issue. Except for the fact that flash messages are consumed by the first request, and will therefore not be rendered in the second request.
I have now worked around the issue by creating a single asset pack for both layouts. But I wonder if there is a way to avoid the second page render.
The text was updated successfully, but these errors were encountered: