aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-06-27 10:03:56 -0700
committerAdam Soltys <[email protected]>2026-06-27 10:03:56 -0700
commit5082edae2a89c202016dc8337ba432aa3409d1ba (patch)
tree19c652554bb0190cfbb1393421f1c5cac1645e8f
parentaa7ccfeae4d778ab62decbd58c3ddb3f74268274 (diff)
downloadcoinosv3-5082edae2a89c202016dc8337ba432aa3409d1ba.tar.gz
coinosv3-5082edae2a89c202016dc8337ba432aa3409d1ba.zip
dev: send no-store so the browser never pins stale dev code
Relaunching Chrome restores tabs from session cache without re-fetching, so old inlined code (e.g. the pre-fix _rpcId path that sent id:null) kept running. no-store also disables bfcache, forcing a fresh build on every load. Co-Authored-By: Claude Opus 4.8 <[email protected]>
-rw-r--r--dev.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/dev.js b/dev.js
index b1d64d8..6dffad9 100644
--- a/dev.js
+++ b/dev.js
@@ -8,23 +8,26 @@ const port = Number(process.env.PORT || 5173);
Bun.serve({
port,
async fetch(req) {
+ // Never let the browser cache (or bfcache) dev assets — every load rebuilds
+ // from source, so a stale HTTP cache or restored tab can't pin old code.
+ const NO_STORE = 'no-store, must-revalidate';
try {
const path = new URL(req.url).pathname;
if (path === '/jsqr.js') {
return new Response(await buildJsQr({ minify: false }), {
- headers: { 'content-type': 'text/javascript; charset=utf-8' },
+ headers: { 'content-type': 'text/javascript; charset=utf-8', 'cache-control': NO_STORE },
});
}
const loc = path.match(/^\/locales\/([a-z]{2})\.json$/);
if (loc) {
const f = Bun.file('src/locales/' + loc[1] + '.json');
return (await f.exists())
- ? new Response(f, { headers: { 'content-type': 'application/json; charset=utf-8' } })
- : new Response('{}', { status: 404, headers: { 'content-type': 'application/json' } });
+ ? new Response(f, { headers: { 'content-type': 'application/json; charset=utf-8', 'cache-control': NO_STORE } })
+ : new Response('{}', { status: 404, headers: { 'content-type': 'application/json', 'cache-control': NO_STORE } });
}
const html = await buildHtml({ minify: false });
return new Response(html, {
- headers: { 'content-type': 'text/html; charset=utf-8' },
+ headers: { 'content-type': 'text/html; charset=utf-8', 'cache-control': NO_STORE },
});
} catch (e) {
return new Response(`Build error:\n\n${e.stack || e}`, {