You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From the docs, it looks like there's a specific set of events that can trap the service worker in an unrecoverable state. (Here "unrecoverable" means that the user has to refresh the page to make the website work.)
I'll try to give my best description of the issue, but I'm still new to working with service workers, so I may have gotten some of the details wrong. If in doubt, I've linked to a primary source at the bottom of this description. :)
Basically what needs to happen to create the unrecoverable state is:
A new version gets deployed to the server.
The service worker is still serving the old main module.
The browser doesn't have a cached copy of the old lazy module.
(because it got reclaimed for disk space, or something like that.)
The server no longer has the old lazy module.
(it only has the newest version.)
At some point, the web page will try to load the old lazy module, and the service worker will need to handle that request.
But, the service worker doesn't have a local copy (the old lazy isn't in the cache)
and the service worker can't request a copy from the server (since the server doesn't have the old lazy anymore).
This is an unrecoverable state.
To fix the problem the user just needs to reload the web page; if they do that, all modules will have updated to the latest version.
Angular's SwUpdate service is able to detect this scenario automatically and prompt the user to refresh; I asked @floogulinc, and he says we should probably be doing that.
(PS: I don't know exactly what steps you can take to reproduce this bug; I only know that it theoretically exists. 🤷🏻♂️ I'm sure there's some way to clear the lazy module from your cache by hand, but I'd have to look up the exact process. 🙃 Sorry about that!)
The text was updated successfully, but these errors were encountered:
From the docs, it looks like there's a specific set of events that can trap the service worker in an unrecoverable state. (Here "unrecoverable" means that the user has to refresh the page to make the website work.)
I'll try to give my best description of the issue, but I'm still new to working with service workers, so I may have gotten some of the details wrong. If in doubt, I've linked to a primary source at the bottom of this description. :)
Basically what needs to happen to create the unrecoverable state is:
main
module.lazy
module.lazy
module.At some point, the web page will try to load the old
lazy
module, and the service worker will need to handle that request.But, the service worker doesn't have a local copy (the old
lazy
isn't in the cache)and the service worker can't request a copy from the server (since the server doesn't have the old
lazy
anymore).This is an unrecoverable state.
To fix the problem the user just needs to reload the web page; if they do that, all modules will have updated to the latest version.
Angular's
SwUpdate
service is able to detect this scenario automatically and prompt the user to refresh; I asked @floogulinc, and he says we should probably be doing that.For more details, see: https://angular.io/guide/service-worker-communications#handling-an-unrecoverable-state
(PS: I don't know exactly what steps you can take to reproduce this bug; I only know that it theoretically exists. 🤷🏻♂️ I'm sure there's some way to clear the
lazy
module from your cache by hand, but I'd have to look up the exact process. 🙃 Sorry about that!)The text was updated successfully, but these errors were encountered: