In the last update to my Angular 7 PWA I added a basic implementation of a service worker. It seems to work nicely and serves the app to the user while downloading updates in the background. If I release an updated version of the web app the service worker will continue to serve the old version until the user reloads the web app (refresh, F5 etc).
So far this has all been well and good but the update I am now planning to release will not work properly until the user refreshes the page. The old version of the app will not work well with the new version of the API. I thought having an 'updateMode' of 'prefetch' would prevent this (see code below).
Is there a way I can deploy an update which the user will see and use immediately without having to refresh?
How can I improve this situation with updates going forwards?
My ngsw-config.json currently looks like this:
Thanks for any advice!
{
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"updateMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.html",
"/*.css",
"/*.js"
]
}
}, {
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": [
"/assets/**",
"/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
]
}
}
]
}