Hi, not sure if this got broken recently or never worked well, but it seems like my browser is not caching the compose wasm app I am hosting on my ktor server:
I think one thing that was changed recently is that the generated JS file now has the file contents hash as its file name to prevent browser caching. Pretty sure this wasn't a thing in earlier versions, so maybe that is tripping you up? Though I am not 100% positive on this.
r
Rok Oblak
01/06/2025, 3:32 PM
I added the basic caching headers configuration like on the code snippet in Christian's link above, plus I added a service worker to cache all requests ending in .wasm. For now it seems to mostly work, though not sure if I am doing things optimally.
c
Chrimaeon
01/06/2025, 4:20 PM
you just need to be careful with caching a web-application. having for i.e. your apps wasm cached and you deploy a new version, a user that already has a cached version will not request the new one (until cache expires). this can lead to issues with other resources that the old app relies on but were removed in your new deployment. thats why cache busting is a thing for web-applications, so each new build gets it’s own “hash” and you can be sure the user has the latest version. Thats what Stan was referring to. I doubt though that is done automatically as you need to adjust the index.html to request the app with the new hash.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#cache_busting