Turbo always reloading when asset (js/css) is added with turbo-track

Hi everyone,

I enabled data-turbo-track="reload" for all of my css/js assets. When I navigate to a page that has a new js/css file, I get a full page reload. I expected it to do a full page refresh when an asset’s url (based on hash) changed, not when a new asset was added.

Did I configure it wrong?

Thanks!

Turbo looks at the combined css/js assets as a “footprint”. When this combined footprint changes, it forces a reload.

@tleish

Interesting, so to use the reload functionality, I’d have to have all my javascript as stimulus, or in one file. Same with css - all of it in one file (ignoring webpack splitting).

Am I understanding that right?

If you want to avoid reload between pages, then 1) keep all js in one file… or 2) include all js libraries in each request.

However, if you use stimulus you can dynamically import JS on certain pages via the stimulus controller.

@tleish

Gotcha. Okay, that makes sense. A little bummed about the css part, but that’s all good, just need to refactor a bit.

I do like the stimulus loading feature, that’s pretty awesome.

Thanks for the help!