I've been struggling the last couple of days with loading a new PWA version in my Angular 11 app. Starting to pull my hair out!
This is not happening for me:
"Every time the user opens or refreshes the application, the Angular service worker checks for updates to the app by looking for updates to the ngsw.json manifest. If an update is found, it is downloaded and cached automatically, and will be served the next time the application is loaded."``` Angular - Service worker in production
I'm using the Angular service SwUpdate.checkForUpdate()
which works great, and detects and prompts the user to reload when a new version becomes available. The app is reloaded and is on the new version, which is perfect.
However, if I close the app on my phone, and re-open it always goes back to the first version when the PWA was installed :(
I've tried SwUpdate.activateUpdate()
window.location.reload()
, changing version numbers, custom service worker... etc. etc.
The only thing that works is to clear my browsing data in Chrome, and re-install the PWA :(
There's nothing that I can do which will cause the PWA cache to be updated with the new version. It is getting the new version, but the cache is not being updated.
Can someone point me in the right direction here? What am I missing?
Android 10, Chrome 89.0.4389.105