Service worker keeps every old build forever #241

Closed
opened 2026-10-21 19:22:22 +00:00 by littlefox · 1 comment
Owner

Found in the performance review (#230, D-058).

app/public/sw.js stores every hashed build file (wasm, js, css) in the cache neokom-shell-v1 the first time it is fetched, and never removes old ones. The cache name doesn't change between versions, so activate doesn't clean them either.

Every release, and every rebuild on the home container, adds another ~4.5 MB of wasm (#231) to the browser's storage on each device. With Kubernetes autorolling each release, phones collect old versions until the browser evicts the site for quota.

Fix:

  • On activate (or after the page has loaded), delete the cached assets/ entries that the current index.html doesn't reference.
  • Or include the build hash in the cache name, so activate's existing cleanup drops old ones.
  • Add an e2e check: load, "deploy" a new build, load again; the cache holds one wasm.
Found in the performance review (#230, D-058). `app/public/sw.js` stores every hashed build file (wasm, js, css) in the cache `neokom-shell-v1` the first time it is fetched, and **never removes old ones**. The cache name doesn't change between versions, so `activate` doesn't clean them either. Every release, and every rebuild on the home container, adds another ~4.5 MB of wasm (#231) to the browser's storage on each device. With Kubernetes autorolling each release, phones collect old versions until the browser evicts the site for quota. Fix: - On `activate` (or after the page has loaded), delete the cached `assets/` entries that the current `index.html` doesn't reference. - Or include the build hash in the cache name, so `activate`'s existing cleanup drops old ones. - Add an e2e check: load, "deploy" a new build, load again; the cache holds one wasm.
Author
Owner

Merged in #258; main run #426 green. Verified: the new PWA test plants an older wasm in the cache and checks only the current one is kept after a reload; it failed without the change. Desktop and Android (WebKit skips service workers on http loopback).

Merged in #258; main run #426 green. Verified: the new PWA test plants an older wasm in the cache and checks only the current one is kept after a reload; it failed without the change. Desktop and Android (WebKit skips service workers on http loopback).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
littlefox/neokom#241
No description provided.