Reference
One page for “why is my new SW stuck waiting?” Source: Archibald lifecycle.
registration.update() if you call it (long-lived tabs)
New version = byte-different SW script (same URL). Do not version the SW filename for production updates.
/sw.js (same URL).install.activates → then controls new navigations.
self.addEventListener("install", (event) => {
self.skipWaiting(); // skip the waiting phase after install
event.waitUntil(/* precache new cache name, e.g. static-v2 */);
});
// install: open static-v2, addAll(...)
// activate: delete caches not in expected list (e.g. drop static-v1)
Never overwrite the old cache name while the old SW still uses it. New name on install; delete old names on activate.