fix(web): stop caching the interface modules

Modules cache independently, so a browser could revalidate one and keep an
older copy of another — leaving a page running one version of itself and a
different version of its helpers. That surfaces as an error inside a
feature, which is nothing like what it is, and no reload short of clearing
the site data reliably fixes it.

A dashboard is a handful of small files read by one person at a time: the
bandwidth caching saves is worth less than the failure it causes. They are
now fetched fresh.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
nocodeandClaude Opus 5 committed 2026-09-23 23:20:08 +02:00
1 parent c031b4d9e2
commit 3f4a5709cf
2 files changed
+15 -2

No files matched your search

+8 -2
View File
@@ -164,8 +164,14 @@ export async function sendStatic(response, root, requestPath, { fallback = null,
...SECURITY_HEADERS,
'Content-Type': MIME_TYPES[extension] ?? 'application/octet-stream',
'Content-Length': info.size,
// The SPA shell must never be cached, its modules are revalidated on each load.
'Cache-Control': extension === '.html' ? 'no-store' : 'no-cache',
// Every module is fetched fresh rather than revalidated.
//
// A dashboard is a handful of small files loaded by one person at a time,
// so the bandwidth saved by caching is worth less than the failure it
// causes: modules cache independently, so a partial revalidation leaves a
// page running one version of itself and another of its helpers, which
// surfaces as an error inside a feature rather than as a stale cache.
'Cache-Control': 'no-store',
ETag: etag,
'Last-Modified': new Date(info.mtimeMs).toUTCString(),
});