Service workers obey a known life cycle that allows a new service worker to get itself ready without disrupting the current one. The life cycle is designed for the best user experience.
When a service worker is registered, it does not immediately seize control of the client. There are rules designed to minimize errors due to differences in code versions.
If a new service worker just took control of a client’s context when it is expecting a previous version’s logic, there could be issues. Even though the service worker operates on a separate thread, the UI code could have dependencies on the service worker logic or cached assets. If the new version breaks, the front-end your user experience could go sideways.
The life cycle is designed to ensure that an in-scope page or task is controlled by the same service worker (or no service worker...