From ed267c554c48a1c3a71450b305b415e609bbc34c Mon Sep 17 00:00:00 2001 From: BenStullsBets Date: Thu, 25 Jun 2026 12:40:34 -0700 Subject: [PATCH] fix(sim): bust HTTP cache on media preload so re-baked clips show MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The preload fetched each clip with the default HTTP cache, so a clip re-baked under the same path (e.g. the cosmos base re-sourced to the Webb Cosmic Cliffs flythrough) kept showing stale footage after a reload — worst case forever, when a pre-`no-cache` build had pinned it `immutable, max-age=1y` (a plain reload never revalidates an immutable entry). Fetch the preload with `cache: "reload"`, which bypasses the HTTP cache, pulls fresh bytes, and updates the cache entry; the in-memory blob cache still gives instant in-session altitude swaps. One fetch per (re)load, so no steady-state cost. 269 passed, 2 skipped. app.js syntax-checked. Co-Authored-By: Claude Opus 4.8 (1M context) --- simulator/static/app.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/simulator/static/app.js b/simulator/static/app.js index 86b0aff..52c9e62 100644 --- a/simulator/static/app.js +++ b/simulator/static/app.js @@ -136,7 +136,13 @@ async function preloadAllMedia(concurrency = 4) { const file = files[i++]; if (!mediaBlobs[file]) { try { - const blob = await (await fetch(mediaUrl(file))).blob(); + // `cache: "reload"` bypasses the browser HTTP cache and refetches from the + // network, then updates the cache entry. This busts a clip whose bytes were + // re-baked under the SAME path (e.g. a re-sourced cosmos base) — including + // one a pre-`no-cache` build had pinned `immutable, max-age=1y`, which a + // plain reload would never revalidate. The blob cache above still gives + // instant in-session swaps; this only affects the one fetch per (re)load. + const blob = await (await fetch("/media/" + file, { cache: "reload" })).blob(); mediaBlobs[file] = URL.createObjectURL(blob); } catch (_) { /* leave it to the network path on demand */ } } -- 2.39.5