When use 'data-turbolinks-track' page rendered twice (double rendering)

97 Views Asked by At

Synopsis

application.html.erb:

<head>
  ...
  <% if content_for?(:head) %>
    <%= yield :head %>
  <% end %>
</head>
...

View:

<% content_for :head do %>
  <%= javascript_include_tag 'script.js', 'data-turbolinks-track': 'reload' %>
<% end %>
...

Script:

The content of the script does not matter, the problem exists even with an empty script file.

Problem

When I go to the view page it is rendered twice (Processing by Foo::BarController#show as HTML and other showing twice in console). When I click on any button on the view page, like "back" or "edit", page by link is rendered twice again. If you reload the page (F5) - everything is fine, it is rendered once. How to fix double rendering with 'data-turbolinks-track': 'reload'? Or am I missing something and this is considered normal behavior?

0

There are 0 best solutions below