Hotwire Discussion

Turbo returning cached version with importmaps

Anyone else seeing Turbo always returning first a cached version of the page when using Hotwire with Importmaps?

Tried adding a data-turbo-cache: false around the individual element, but still getting cached.

Saw in the docs that there is a way to opt out of cache by adding this

<meta name="turbo-cache-control" content="no-cache">


I haven’t tried importmaps yet, but does annotating data-turbo-track="reload" to your importmap script resolve the caching?

<script type="importmap" data-turbo-track="reload">
  "imports": {
    "moment": "/node_modules/moment/src/moment.js",
    "lodash": "/node_modules/lodash-es/lodash.js"

see: Reloading When Assets Change