F
F
floydback2019-07-24 15:14:12
Software Deployment
floydback, 2019-07-24 15:14:12

How to make changes and deploy to the PWA application code?

I have two questions.
1. How often is the PWA app cache refreshed if nothing is done? For example, will the default browser do this once a day, a week, or some other time? Or can it be specified somehow in the manifest?
2. How can I force an app update after a new version has been downloaded? Does service-worker.js do this? What about should be so that it checks the version by creation date.
I thought it worked like this: when the application is opened (if there is internet), only service-worker.js is loaded from the server, and then service-worker.js is either loaded from the cache, or if the file modification date (taken from the nginx header) changed - loads everything again.
However, I deploy, open the application in the browser, but it is old. I see that the service-worker.js request is being made to the server. Nothing seems to help other than clearing the app cache.
Tell me what I'm doing wrong and what I don't understand.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dollar, 2019-07-24
@dollar

If the manifest on the server is changed at least by a byte, then within a day the application is guaranteed to be updated (if there is an Internet, of course).
And I remember exactly that I made the application update button in the background even before the invention of any service workers. But that was so long ago that I won't say what the mechanism was. It was somehow checked whether there was an update or not, and displayed to the user in the application settings, and then he could update if he wanted.
In general, try tritelocation.reload();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question