-
Notifications
You must be signed in to change notification settings - Fork 816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow on-demand precaching for cache recovery #2858
Comments
A few random thoughts:
|
Thanks for the considered response! There are some interesting things here.
|
Sure—this is a complex space where some browser environments might not always behave as expected, so it's good to talk it through.
|
You can try out the precaching repair functionality in https://github.com/GoogleChrome/workbox/releases/tag/v6.3.0 |
Library Affected:
workbox-precaching
Browser & Platform:
All
Issue or Feature Request Description:
In Workbox v6, PrecacheController changed such that precaching can only be performed during certain SW lifecycle events. This unfortunately breaks a use case that was supported in v5 and before -- cache recovery. If SW cache entries are removed by a browser while the SW stays active, offline mode will not work even though the SW seems healthy. We were doing cache validation based on the embedded manifest during app startup, and triggering a precache run with
controller.install()
if any entries from the manifest were missing from the cache.A workaround for this case is to unregister the service worker such that reinstallation will trigger precaching, but critically, this won't happen until the next application load, which is problematic for long-lived app sessions.
A top-level API like
validateAndRecoverPrecache
next toprecacheAndRoute
would be ideal, but barring that, restoring ad-hoc usage of the PrecacheController's installer would also work.The text was updated successfully, but these errors were encountered: