Automatically Invalidate JavaScript Cache on Custom Component Updates?

Hi everyone,

I’m the developer behind the custom component Linus Dashboard, which automates the creation of dashboards for Home Assistant.

I’m encountering an issue with JavaScript caching: after each update, my users often experience problems because their browsers retain an older version of the dashboard in cache. Currently, I always ask users to manually clear their cache to resolve this, but that’s far from ideal.

I’ve tried appending a version number to my JavaScript file to force cache invalidation, like this:

linus-strategy.js?v=1.1.1-alpha.2

Unfortunately, this method doesn’t seem to work as expected, and my users still need to manually clear their cache.

Has anyone faced a similar problem? Are there any tips or best practices in Home Assistant for automatically invalidating the JavaScript cache when updating a custom component?

Thanks in advance for your help!

Julien