Closed oldergod closed 8 years ago
I’ll go with 2. Option 3 might convey that a thing is working even though it is actually not when going offline. I’ll just refresh the entire static cache and rely on HTTP caching headers to not redownload data the user already has.
PR incoming.
Via the PR #24 I added new files to the static cache here: https://github.com/GoogleChrome/css-triggers/pull/24/files#diff-c0d537be4c9b8578091846d7aa37044bR33
But as you can see in the sw.js code ( https://github.com/GoogleChrome/css-triggers/blob/master/src/scripts/sw.js#L49 ) , regardless of the version, if the
STATIC_CACHE
exists, we exit the static files caching process. Hence, the 2 files added above will not get cached. Lastly, because the sw.js is made as it is, if a static file is not cached, its request will return 404. As a result, the icons are displayed on a shift refresh only.@surma I know you had long conversations with @jeffposnick about how to write the sw few months ago so I wanted to ask your opinion on this before trying to fix it.
I was thinking of one of this way:
var VERSION
and update the static cache based on it.fetch
so we cache static files when they are not found in the cache, instead of sending a 404 response.I would personally go with 3 or 2.