Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Website stuck on v16 due to caching (service worker) #908

Closed
TimonVS opened this issue Sep 20, 2023 · 5 comments
Closed

Website stuck on v16 due to caching (service worker) #908

TimonVS opened this issue Sep 20, 2023 · 5 comments

Comments

@TimonVS
Copy link

TimonVS commented Sep 20, 2023

For some reason, on my laptop I keep seeing the old docs website for v16.3.1. After a hard reload, it briefly shows the website for v18, but after a refresh it's back to the old site. The same goes for "Empty cache and hard reload". I noticed that index.html is proxied through a service worker, which is probably the culprit. This problem doesn't occur on my phone, or in any other browser (probably because I didn't open the website before v18 was released).

CleanShot 2023-09-20 at 14 13 02@2x
CleanShot.2023-09-20.at.14.18.58.mp4

node-tap.org.har.zip

@isaacs
Copy link
Member

isaacs commented Sep 20, 2023

So weird. Maybe I can tell netlify to send some cache control headers to bust it?

@TimonVS
Copy link
Author

TimonVS commented Sep 20, 2023

It's probably a Service Worker related issue, which might not be solved by busting the cache. Maybe this will work: https://developer.chrome.com/docs/workbox/remove-buggy-service-workers/. I think you should be able to create sw.js hosted at http(s)://node-tap.org/sw.js and put the code in there. I'm not a 100% sure this will solve the problem, but I can at least check it for you :)

@isaacs
Copy link
Member

isaacs commented Sep 20, 2023

Ah, found the culprit. The former website was using a gatsby offline plugin.

Thankfully, it uses a static URL for its service worker, and so the no-op sw.js should fix things.

I also am not using any localstorage or anything, so also set the Clear-Site-Data: "storage" header, which should clear it out as well, even if the sw.js isn't re-loaded.

Lmk if that fixes the site. If so, it'll be in the next release, just need to finish up some other stuff before landing it on main.

isaacs added a commit that referenced this issue Sep 20, 2023
isaacs added a commit that referenced this issue Sep 21, 2023
@TimonVS
Copy link
Author

TimonVS commented Sep 21, 2023

This fixed the issue! Thank you so much! 😄

@isaacs
Copy link
Member

isaacs commented Sep 21, 2023

Oh, thank you for finding the problem, the solution, and verifying the fix 😅

@isaacs isaacs closed this as completed in cb096de Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants