-
Notifications
You must be signed in to change notification settings - Fork 660
Keep a PSK Progressive Web App fresh, without requiring user reload #806
Comments
I think that's because the platinum elements use a default cache strategy of "fastest" which goes cache first, then network. I believe you can configure this: https://elements.polymer-project.org/elements/platinum-sw#property-defaultCacheStrategy
Sounds like a Chrome bug, you might file a ticket on crbug.com Let me know if changing the cache strategy fixes your issue. |
I think you'll likely see something similar in PSK2 because we're using sw-precache and it uses the cache-first-then-network strategy. This means pages will be served as fast as possible but may be stale. @jeffposnick is the sw-precache strategy configurable? I seem to recall that it is but I looked over the docs and couldn't find the option |
There's a pattern for detecting when the service worker has been updated, and using that to trigger some sort of toast or warning on the page that there's new content available, and telling folks to reload. There's also a feature request for new functionality that would use |
@jeffposnick is there a configuration option to set sw-precache to network-first if that's the behavior I want in my app? I feel like platinum elements used to support this using sw-precache under the hood |
You can actually do that while still including // Config passed to sw-precache:
{
runtimeCaching: [{
urlPattern: /./, // Match everything
handler: 'networkFirst'
}]
} (Untested, but I think this will effectively inline It's not what I'd recommend, because you're losing the performance benefits of a cache-first strategy, but yeah, it's possible. The platinum elements never used |
I see. In the near term it might be beneficial for us to add the toast pattern because I bet a number of folks will be confused by it. Another option is to dev with |
👍 to the idea of the toast pattern. Cache-first can be confusing without it, but with a meaningful toast, I think users get the best of both worlds. |
👍 to the toast pattern. |
I am using toast in PWA template https://github.com/StartPolymer/progressive-web-app-template/blob/master/src/app-service-worker.html#L119 |
Closing this issue as duplicate of #1046. I think it is good to add a toast that notifies the user the site is updated, just like the docs site does. |
Is this in scope? I found the behavior to be somewhat flaky, though it might depend on the particulars of Firebase hosting.
I'm hosting a PWA-pitching PWA based on PSK on Firebase. Here are the repro steps:
gulp && firebase deploy
.The text was updated successfully, but these errors were encountered: