How to handle a case that my website doesn’t show the latest update after deployment because of cache?

I have a website (in React with VITE) that in my latest hotfix where I didn’t change the version tag and just fixed a specific bug.
After the deployment was done I’ve seen that I can’t see the updates until I refresh the browser, and sometimes it still requires me to refresh in order to see the changes.

I’ve read that it is caused because my headers are not changed so the chrome uses the cache (in my headers I put also the version name).

One way that I’ve seen that can solve this problem is using react-clear-cache in order to clear the cache.

Is that a good practice? or are there any better practices like better versioning management that enforce the cache to be updated because it changes the headers?

Thanks ahead.

Leave a Comment