I'm trying to load a javascript only on a certain page. For that I'm using <%= yield(:head) %>
in the <head>
and the following on the page:
<% content_for :head do %>
<%= javascript_import_module_tag "foo" %>
<% end %>
This works when clicking on a link to the page the first time. However when further I navigate anywhere and then go back again, Turbo conserves the head part (<script type="module">import "foo"</script>
). Thus this script is not executed anymore.
Is there a way to tell turbo, that it shouldn't 'cache' this?