alex32's avatar
Level 2

Vite 5 | clear the cache on new session

After the user login some css is not loaded until I force a page reload with Ctrl-F5 (Opera). Is there a way to clear the cache after the user starts a new session? I'd like to avoid the trick below as the asset will be always reloaded. I need a refresh only when a new session starts. Many thanks

  • Laravel 11
  • Vite 5
@vite(['resources/js/sttheader.js'?a=1])   // this will load JS and CSS files

0 likes
2 replies
Snapey's avatar

I need a refresh only when a new session starts

no, you need to reload these assets after you change your code or css

alex32's avatar
Level 2

Thanks for your reply. When I test the page against new code changes, all assets are loaded properly (Ctrl-F5) after Vite compiles them . It's only when the session expires (the next day I login) that the page is missing some CSS and I need to force a reload with Ctlr-F5. Am I missing anything?

Please or to participate in this conversation.