DockYard/ember-service-worker

SW Invalidation Wish List

bcardarella opened this issue · 0 comments

Developing with SWs is a difficult experience. I believe that we can do better. There are two specific changes that I believe can help improve this experience.

CLI Flag

Setting an explicit flag with ember s to completely disable the SW all together would be best. I believe if something like EMBER_SW=false is present on process.env then the SW should simply render as:

registration.unregister();

This would of course force the SW to not only run but also unregister its previous incarnation so that any lingering caches are invalidated.

Development Rebuilds

During development making changes to the add triggers a rebuild. This can lead to a difficult experience as it means you have to do a hard refresh in the browser. But the previous cached items are still there. So you can empty the cache or delete the SW.

It would be a better experience if during the development environment the SW is versioned to a datetime value of the last rebuild. Or maybe this is yet another strategy that is a default for dev. This would result in the SW re-registering itself after each rebuild.