Merge pull request 'fix(sim): bust HTTP cache on media preload so re-baked clips show' (#22) from fix/preload-cache-bust into main
This commit was merged in pull request #22.
This commit is contained in:
@@ -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 */ }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user