Using Workbox 4.3.1:
I've followed the advance recipe here: https://developers.google.com/web/tools/workbox/guides/advanced-recipes
It all works great if when the user refreshes the page, a new service worker is detected and it goes into waiting.
I'm doing that but also setting an interval to call "wb.update()" to check for new versions since people don't reload my PWA very often.
This works in that the serive worker goes into waiting, and when they click my update button, the "SKIP_WAITING" message successfully bumps it active, but the "controlling" hook doesn't work anymore for some reason, and so "window.location.reload()" doesn't work.
Any ideas? The advanced recipe doesn't mention anything about clients claim, but I do have workbox.core.clientsClaim() in my service worker.
After about 80 different experiments, the only thing that worked was to insert
navigator.serviceWorker.addEventListener("controllerchange", (event) => {
window.location.reload();
});
Right before...
messageSW(this.waiting, { type: "SKIP_WAITING" });
Hope it helps someone. I did find some info on this in later version of workbox (v6?), so maybe it's fixed there.