This problem mostly impacts sites that make heavy use of code-splitting in their frontend and have visitors staying a long time. We even ran into it on
app.netlify.com which is also running on Netlify.
I think why it happens is pretty clear from the thread.
There are a few ways this problem can be solved. These can be combined.
Enforce the usage of the currently loaded deploy when people load the page
If you want to make sure that on loading the entrypoint html site for your app, people will only access the files of a single specific deploy, it is best to use the unique deploy url.
It might look like this: https://5e85abb1a640d40006504f77--cms-demo.netlify.com/
You get them by clicking on the timestamp on a finished deploy in the deploy overview.
This url will always point to the same set of files - remember: Netlify deploys are atomic.
You can automate this using the
DEPLOY_URL environment variable in your build.
Depending on your build setup you should be able to inject a value from an environment variable.
Your final script tag might look like this after inserting the env var:
Prompt visitors to reload the page if your app was updated
Many larger apps sometimes give you a notification that you should reload the page to get a new version of an app. You could implement the same for your app.
You should be able find resources about how to enable a service worker for your app. If you only want to use the service worker for the notification and not for offline caching, you might need to update the settings to disable local caching.