Reputation: 14641
I have a Vue app that is used both in the browser and as a PWA. I would like to ensure users receive the latest version whenever updates have been pushed to the server.
I am using Nginx
, Django
and vue-cli
along with @vue/cli-plugin-pwa
.
Currently when I npm run build
and then push the new version to the server, users get the old version of the app (in browser as well as PWA on their phones). To get the new version they do a hard refresh in the browser or for the PWA they close the app and reopen it again.
Is there a way to ensure a version check is done every time the app is loaded so that the new version is retrieved?
Upvotes: 8
Views: 6001
Reputation: 14641
In the end I found this excellent article which covers how to display a notification when an update is available. The user is then able to click the notification which updates the app.
https://dev.to/drbragg/handling-service-worker-updates-in-your-vue-pwa-1pip
Upvotes: 11