Reputation: 63
So currently, I'm working on this PWA with React JS. The app is being served from Amazon EC2. And once on the app, I can add it to home screen and use it to get better experience and feel. The app is still under development and once there are some new updates, I update the app on EC2 but the app added to home screen doesn't catch those new changes rather keeps on working with the older version. Is there any way to update the home screen app with the new changes from the server? Right now, the work around is to delete the added app from home and open up the app in the browser and then add it again to the home screen to get the latest version. I'm not looking for any manual solutions for this as user experience is priority. Looking for a way to do this from service worker or any other way. Would really appreciate your help.
I have been looking for solutions but couldn't find one.
Upvotes: 0
Views: 49
Reputation: 10830
I answered to a similar question on SO here
Google Web Docs provide a great explanation about SW update rules.
As Adolfo said, you have to close the browser tabs where the SW is running and navigate to a different URL. Then when you come back to your app, the SW will check for updates.
Service workers have also a built in feature called "fail safe". Within at most 24H the SW automatically checks if a newer version is available on the server and, if so, attempts to update to it.
Upvotes: 1