coder / code-server

VS Code in the browser
https://coder.com
MIT License
66.51k stars 5.45k forks source link

tmLanguage.json changes do not appear without resetting browser cache #6798

Open deser opened 1 month ago

deser commented 1 month ago

Is there an existing issue for this?

OS/Web Information

Steps to Reproduce

  1. Open vscode in browser, open network panel, uncheck "Disable cache"
  2. Make a change to tmLanguage.json (for example add 1 symbol in existing "$comment" field, like "$comment": "Hello" -> "$comment": "Hello1")
  3. Re-deploy code-server
  4. Reload the browser page with vscode
  5. Observe in network panel that tmLanguage.json is not having the change

Expected

tmLanguage.json is not cached by browser when it has any changes

Actual

tmLanguage.json is cached by browser when it has any changes, so these changes do not appear until the page with vscode is reloaded without cache

Logs

No response

Screenshot/Video

No response

Does this bug reproduce in native VS Code?

I did not test native VS Code

Does this bug reproduce in GitHub Codespaces?

I did not test GitHub Codespaces

Are you accessing code-server over a secure context?

Notes

I investigated a little bit and here are some thoughts:

  1. I see that the code-server uses weak eTag to cache resource, I verified that on changes to tmLanguage.json eTag is not getting changed.
  2. Seems like service worker (service-worker) intercepts requests, and, when catching 304 responds with cached resource which has 200 status. That's confusing to observe, that etag resource has 200 but not 304.
code-asher commented 1 month ago

Interesting, I believe the eTag and service worker are provided by VS Code, which means this might be an upstream issue https://github.com/microsoft/vscode

But, maybe there is something odd in the way we wrap VS Code that causes the issue. We should try to reproduce in Codespaces to see if it is an upstream issue or a code-server issue.

YOUSSEF663xxj commented 1 month ago

https://github.com/microsoft/vscode/blob/4c4ac63f36df8d9ae67f894686d1ffbaf8cb5294/src/vs/workbench/services/timer/browser/timerService.ts#L666