Description
There is a similar issue #4152, but the main difference is that I am not using a service worker just yet and it's a static deployment, no backend serving the content. This error did not make sense to me for a long time as I was unable to reproduce it, but yesterday it finally happened.
The scenario is quite a simple, there is a deployed app using code splitting (and React.lazy
) which is loaded into browser except that some chunks are not yet loaded because they weren't needed before. If we deploy a new version later and suddenly user decides to go into the part of the app he wasn't before, it is looking for an older chunk that's not already there and 💥
I am wondering what is the proper solution to this. If there would be some way how to catch that error, I could force reload the app which ultimately is what needs to happen I suppose.
Honestly, I am a bit scared of registering service worker. The app is still heavy under development, but it's already in a production. Sadly there is nothing like release calendar on the team and it's not unusual to have 1-5 deployments to a production per week 🙄. Sometimes it's more or less a critical fix that should be delivered to customer ASAP. Is there some strategy to essentially detect that new version has been deployed and force the service worker to reload?