Course contentsShow
← Web Development
Lesson 2375 of 2,98243. Service Workers Deep DiveFree lesson

The Redundant State

Understanding when and why service workers become redundant and are replaced.

The Redundant State

You'll learn when and why service workers become redundant and are automatically replaced by the browser.

What "Redundant" Means

After a service worker moves through the installing, waiting, and activated states, there's one final state it can enter: redundant. When a service worker becomes redundant, it's essentially "retired"—the browser has discarded it and it will never control pages again. Think of it like an old phone that gets replaced: once you switch to the new one, the old phone becomes redundant.

When Service Workers Become Redundant

A service worker enters the redundant state in these scenarios:

  1. Replaced by a newer version - When a new service worker successfully installs and activates, the old one becomes redundant
  2. Installation fails - If the install event handler throws an error or a promise rejection occurs, that service worker immediately becomes redundant
  3. Manual unregistration - When you call registration.unregister(), the current service worker becomes redundant

Why This Matters

The redundant state exists for cleanup. Once redundant, the service worker stops intercepting fetch events and handling messages. The browser can garbage-collect it to free up memory. This prevents old, buggy, or outdated service workers from lingering and causing problems.

You typically don't need to handle the redundant state explicitly—it happens automatically. However, understanding it helps you debug update flows and understand why certain service workers are no longer active.

Key Takeaway: The redundant state is the final state where a service worker is discarded—either replaced by a newer version, failed during installation, or manually unregistered.