I launched an upgrade of our popular job board as a PWA using code from the Firebase Friendlypix-web demo. My app is very different from that demo but some of the code I didn't change: the service worker. And I think that my service worker has gone rogue...
I changed the DNS back to our old website a few days later but I seem to have lost control of the website for thousands of users who visited during that brief period last month.
A hard refresh is not enough to remove the website between browser restarts, on Chrome at least. I eventually figured out how to unregister the service worker using chrome://serviceworker-internals/.
The codebase I used includes a workbox-sw.js with following code:
workbox.routing.registerRoute(
/\.(?:png|gif|jpg|jpeg|svg)$/,
workbox.strategies.cacheFirst({
cacheName: 'images',
plugins: [
new workbox.expiration.Plugin({
maxEntries: 60,
maxAgeSeconds: 30 * 24 * 60 * 60, // 30 Days
}),
],
}),
);
// Routes for all dynamic HTML pages.
workbox.routing.registerRoute(
// Cache HTML files
/[^\.]*/,
// Use cache but update in the background ASAP
workbox.strategies.staleWhileRevalidate({
// Use a custom cache name
cacheName: 'html-cache',
})
);
I don't understand if that is related to my problem.
What do I need to know if I want to relaunch such a PWA and retain the ability to update it?