Cached version of website not updating on new build/repo change

Hi! I recently switched my Github deployment over to a different repo, however, after deploying the new website it seems to still show the old version of the website on my browser.

If I go into Incognito mode it shows the new version, so I tried clearing my cache etc but nothing works.

my website is stanlee.codes

Edit:
I ended up deleting the site all together, and deployed a new site using the same custom domain name.

It’s still showing the cached version of the website on my devices

I was trying the suggestions from

This seems like a service worker problem. If you share the correct link of the website or the repo, someone can confirm.

This is the correct link of my current website.

I’ve had to clear my cache on devious through dev tools → application → cache → cache storage and delete it.

Other users who have visited the previous version of my website are still seeing the previous version, not the new one.

Yes. That’s what happens due to service workers. You’d have to add logic to the service worker to delete the old cache when new one is available.

Do you have any suggestions on how I would proceed with doing this? I’ve added a separate CSS file and started changing the versions but beyond that I have no clue how to work with the service workers

Try unregistering the service worker.

if ('serviceWorker' in navigator) {
  navigator.serviceWorker.register('/sw.js').then(function(registration) {
    // registration worked
    console.log('Registration succeeded.');
    registration.unregister().then(function(boolean) {
      // if boolean = true, unregister is successful
    });
  }).catch(function(error) {
    // registration failed
    console.log('Registration failed with ' + error);
  });
};

Note, change the service worker path with your own.

hi there, this might also be helpful: