Search code examples
angularprogressive-web-appsservice-workerservice-worker-events

Updating an Angular PWA in a controlled manner: Questions


I've been playing around with angular's PWA. I got everything running as I wanted, but I still have some unanswered questions:

  • The swUpdate.available observable randomly fires twice (at once). How come?
  • What if I prompt the user with a dialog when an update is available, but he declines - will swUpdate.available ever fire again?
  • Calling swUpdate.checkForUpdate() sometimes takes under 100ms, and sometimes a really long time (+90sec). What can be the cause?
  • Finally, when opening my app (with PWA) the first time, the initial load often takes a long time (+10 sec), although I am using registrationStrategy: 'registerImmediately'.

I find the swUpdate API to be a bit archaic. Why does checkForUpdate() not return an Observable with the UpdateAvailableEvent if there is any? 🤷‍♂️

Cheers


Solution

  • As I could not fix this problem, I switched to Workbox