Definition
waiting state (service worker)
A service worker enters the waiting state after install succeeds but before it can activate, because the browser only replaces an active worker once every page it currently controls has been closed or navigated away from. It stays here indefinitely until those pages close or the code forces the transition with skipWaiting().
This staged rollout exists to prevent a page from suddenly being served by mismatched worker logic mid-session — for example, an old page expecting API shape A should not suddenly be intercepted by a new worker that assumes shape B.
You can detect a waiting worker from the page with registration.waiting, commonly used to show a "New version available, refresh to update" banner rather than silently forcing a reload.
A common pattern posts a message to the waiting worker (worker.postMessage({type: "SKIP_WAITING"})), and the worker's own message handler calls self.skipWaiting() in response, keeping the decision to update in the user's or app's hands rather than happening automatically.
Leaving many tabs of the same PWA open indefinitely is the most common reason teams see "why isn't my update showing up" bug reports — each open tab keeps the old worker active and the new one waiting.