How to handle stale resources in production?

In a user session on LogRocket I see that the user is experiencing an error page due to "TypeError: Failed to fetch dynamically imported module:"

The reason seems to be that the user was re-using a browser tab that loaded the app before the latest deployment, the hash of the resouces are changed, and the resource doesn’t load.

The user then reloaded the page and everything was fine.

Is there a way to circumvent the issue without having to manually reload the page? Could we automatically reload the page if a resource is not loading for example?

This is a known issue with no implemented fix yet :confused:

We’re tracking it here

Please add any extra input you might have to that issue thread

Thank you, I will try David’s workaround snippet, it’s exactly what I was looking for