2
votes

I'm developing a React web-app (https://timatorg.is - in case someone wants to look at the response headers) created using create-react-app. At the time it was created, a service worker was registered by default and I didn't really think much about it. The app is hosted at Netlify and the DNS is at Cloudflare.

Now when deploying updates to the website, users that have visited the site before always get the same version of the app and I'm pretty sure it's because of the service worker. But the strange thing is that it's only "https://www.timatorg.is" that is causing issues, not "https://timatorg.is"

I've read a lot of material about how to unregister an already cached service worker but all I've found is a solution that the client can perform in his/her browser but nothing that I can do to solve this for all of our clients.

So my question is, how do I get rid of the service worker? Or more general, push the latest update of our app to our clients?

1

1 Answers

5
votes

You can change to the following in your index.js file, like the comment in a new Create React App project says:

import { unregister } from './serviceWorker';

// ...

unregister();