Twitter | Search | |
Jeff Posnick
🏢 Google's Web DevRel Team (), 🏠 Brooklyn, NY, 💘
4,661
Tweets
801
Following
2,804
Followers
Tweets
Jeff Posnick 2h
Sorry about the negative experience in the meantime :-/
Reply Retweet Like
Jeff Posnick 2h
Took a quick look at your hosting setup, and based on how your 301 redirects are set up, sounds like the culprit. It's fixed in the current Workbox v4 alphas, but backporting to v3 (which Gatsby using) is on the table. Will follow up in that bug.
Reply Retweet Like
Jeff Posnick 3h
The concern is that after your client-side code initially registers a SW, the SW takes controls and responds to future navigation requests with garbage HTML. That prevents your client-side code from executing again. The SW script update check will still happen in that scenario.
Reply Retweet Like
Jeff Posnick 3h
Adding to your response headers for your SW script is another option, (but only supported in Chrome and Firefox). In both cases, you take advantage of the fact that a browser's update check for a new SW script bypasses the existing SW's fetch handler.
Reply Retweet Like
Jeff Posnick 3h
That just relies on the SW update flow to make sure that the "kill switch" gets a chance to run, and while it was previously possible to mess *that* up with incorrect Cache-Control headers, that less of an issue now:
Reply Retweet Like
Jeff Posnick 3h
I would avoid depending on "kill switch" logic in `window` context, since it doesn't help when you deploy a SW that prevents your `window` context code from running. is a pattern of shipping new SW code to the existing URL to "neuter" the previous bad SW.
Reply Retweet Like
Jeff Posnick 3h
has steps you can follow to mitigate things. Any chance you have the old SW file laying around? I'd love to get to the bottom of what went wrong. (CC: , as I don't know who from the Gatsby team is maintaining the offline plugin nowadays.)
Reply Retweet Like
Jeff Posnick 3h
Replying to @simevidas @getify
Just as an FYI, I'm nervous whenever I see runtime caching of potentially large assets (like videos) without any expiration policies in place. Quota errors can be a problem on space-constrained devices. You can read more at how Workbox can help at
Reply Retweet Like
Jeff Posnick 9h
I'm sorry to hear about that experience :-/ If you're left with anything to clean up, is one approach to getting existing clients back into a neutral state. (And we're happy to dig into what went wrong if you feel like sharing details.)
Reply Retweet Like
Jeff Posnick 19h
Replying to @samthor @gguuss
No, I live in a Switch household. I was just making a musical joke, and now I feel like an outcast.
Reply Retweet Like
Jeff Posnick retweeted
Chrome Developers Oct 18
Accelerate your Javascript with 's performance tool suggestions in this week's State of the Web with . ⚡️Watch here →
Reply Retweet Like
Jeff Posnick 19h
Replying to @MylesBorins @kosamari
Still on 5, soon to be 10.
Reply Retweet Like
Jeff Posnick 19h
Replying to @gguuss
What's cooler than being cool? (An external fan for your PS4.)
Reply Retweet Like
Jeff Posnick 19h
Replying to @kosamari
We'll probably have gone through several desk moves by the time you get back.
Reply Retweet Like
Jeff Posnick 19h
Replying to @kosamari
...you're about to spend 3 weeks in London, right?
Reply Retweet Like
Jeff Posnick Oct 18
Chrome 71 has a couple of spec-compliance improvements: - Disallowing asynchronous (post-install) importScripts() in a SW - Logs a warning (prelude to deprecation in 72) if you use the same URL multiple times in a single cache.addAll() call 📖 more at
Reply Retweet Like
Jeff Posnick Oct 17
Replying to @nhoizey @tomayac and 2 others
Sorry, the matchCallback docs are It would look something like const matchCb = ({event}) => event.request.destination === 'video'; const handlerCb = /* ... */; workbox.routing.registerRoute( matchCb, handlerCb );
Reply Retweet Like
Jeff Posnick Oct 17
Replying to @nhoizey @tomayac and 2 others
Yup. Take a look at for some discussion of that. You can swap out the RegExp for a matchCallback function.
Reply Retweet Like
Jeff Posnick Oct 17
I've added some context as to what's going on at For those following along at home, and approach like should work. Cached video playback is messy. workbox-range-requests helps, but there are still a lot of things to go wrong.
Reply Retweet Like
Jeff Posnick Oct 17
Replying to @simevidas
Gotcha. Definitely a "you know your site's users" best scenario when making the call about whether offline-without-video is better or worse than no-offline.
Reply Retweet Like