-
-
Notifications
You must be signed in to change notification settings - Fork 292
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
Pre-existing service worker and cleared cached storage prevents pre-caching. #247
Comments
Why would you do that? Anyway, when new SW activates (when you close all tabs) it will pre-cache all assets and you will have your cache full again.
If user deletes their cache manually I don't see why |
Sometimes people clear their browsing history and/or other data their browser has stored (e.g. cache storage).
I tried clearing the cache and then re-opening the browser, but it does not do what you describe.
If we are to develop websites/webpages and we don't have total control over users' browsers (e.g. to prevent them from clearing their caches), then why would we not want to accommodate for that? |
You're somehow misreading it. All tabs closed make new SW leave waiting state and became active. Here more details. Of course it will happen if you have build new SW, i.e. with a new version. If not, it's still the same ServiceWorker. |
Thanks for helping me understand service workers more. If we take this scenario:
This happens because the previous service worker is still registered and has already been installed and activated. Would you agree that the scenario above is possible? If so, would you be interested in trying to address it, specifically re-pre-caching via another means? E.g. In the "fetch" event handler (of the service worker), maybe have a condition like so:
What do you think? |
Yes, I agree with that.
Yep.
I think it would be better as:
|
According to this MDN docs page, specifically this paragraph:
I was experiencing undesirable behaviour in my application, where assets were not being pre-fetched appropriately.
I tracked down the problem to the above docs paragraph, specifically that the problem arises when you have a prior service worker still registered and have cleared the browser's cache storage.
This results in assets being cached on demand, as opposed to being pre-fetched and pre-cached.
Is this intended behaviour of the plugin, or have I stumbled upon a bug?
If things are still unclear, I can whip up a small repo to reproduce the problem.
The text was updated successfully, but these errors were encountered: