3 ms·
I think service workers are the biggest foot gun to web development. There are so many issues you bring to the table just to have offline capability. First you
by aclatuts 8y ago
I think service workers are the biggest foot gun to web development. There are so many issues you bring to the table just to have offline capability.
First you have to design a service worker that can intelligently download new updates to your app, relay to the user there is a new version, and you have to make sure you support changing apis as clients can be using the old versions of an app for a long time.
You have to design self destruct logic because your service worker itself can have bugs and break your app. In addition your self destruct logic can break.
You also have to make sure you service worker does not infinitely cache an old version of you app, because it will never expire without correct logic. You cant just assume to download higher version numbers, some times you want to revert to an older version of your app.
- k__ 8y agoCan't you just add a dead mans switch?
- Arnavion 8y ago>You cant just assume to download higher version numbers, some times you want to revert to an older version of your app. I would assume you would republish the older version as a new higher version. It's not uncommon in regular software releases.
- AgentME 8y agoThere were previous proposals like appcache which tried to do the right thing and handle a lot of details like this for the developer, but it didn't fit every use-case well. So instead, browsers implemented something more raw that just focused on exposing all of the necessary capabilities. I think the hope is that web developers create reusable abstractions over service workers and most people just use libraries for dealing with them (and if any of the libraries end up on a really powerful abstraction, maybe that will get baked into browsers later).
- crooked-v 8y agoAlso, manually clearing out service workers in the browser is frustrating to the point of absurdity while trying to work on stuff.
- geofft 8y agoI thought the worker is required to be re-downloaded every 24 hours (well, possibly as long as you have connectivity) specifically to avoid foot-gun risks? Or is that something that's they're still figuring out the details of?
- crooked-v 8y ago24 hours is a long time for a web app to be broken.
- wbercx 8y agoNot only one of the most creative talks I've had the pleasure of attending, but also a good showcase of what happens when you fire this foot gun: https://www.youtube.com/watch?v=t7WraVE8rY8 https://www.youtube.com/watch?v=t7WraVE8rY8