Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Add simplified service worker invalidation #2551
Adds invalidation of service workers based on by attempting to
This issues the issue where sites hosted on the same
This was referenced
Jun 17, 2017
jeffposnick left a comment
With the caveat that it's unfortunate that this sort of logic needs to be implemented by each framework/starter kit, rather than being baked in to the browser, I understand why you'd want to move ahead with this brute-force approach in the interim.
I've just got the one comment about potentially only running this additional logic on
Added the check so it only applies on local host as per @jeffposnick code.*
Personally, I liked the check happening on live servers because it means that if you deployed an app with CRA and then later deployed an app with some other boilerplate, to the same domain. The user (and developer) doesn't get stuck.
It also shouldn't cause a slow down, because we are instantly displaying the app regardless. Its just if there is no service worker found. We reload it right away with the SW removed. (Alt. would be to removed the SW and show the toast from #2426).
However, this is a good start and would be useful to be merged in with only localhost.
Jun 27, 2017
I'd appreciate if you could test the latest version and ensure it works as intended.