From b4e7cce65110e3baccaaf891c19d27740163ad8b Mon Sep 17 00:00:00 2001 From: Paul Nothaft Date: Fri, 16 Jan 2026 16:53:34 +0100 Subject: [PATCH] fix: Add cache control headers and improve typing indicator - Add proper cache control headers in static.ts - HTML files: no-cache to always get fresh version - Assets: long cache with immutable (content-hashed filenames) - Improve typing indicator animation (larger dots, faster animation) --- client/src/components/AiChat.tsx | 10 +++++----- server/static.ts | 19 ++++++++++++++++--- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/client/src/components/AiChat.tsx b/client/src/components/AiChat.tsx index 9fda0e7..ce17c7a 100644 --- a/client/src/components/AiChat.tsx +++ b/client/src/components/AiChat.tsx @@ -13,13 +13,13 @@ interface Message { content: string; } -// Typing indicator with animated dots +// Typing indicator with animated dots - v2 function TypingIndicator() { return ( -
-
-
-
+
+
+
+
); } diff --git a/server/static.ts b/server/static.ts index edd8413..a3cec83 100644 --- a/server/static.ts +++ b/server/static.ts @@ -22,11 +22,24 @@ export function serveStatic(app: Express) { ); } - // Serve static files from the public directory (includes attached_assets) - app.use(express.static(distPath)); + // Serve static assets with long cache (they have content hashes in filenames) + app.use("/assets", express.static(path.join(distPath, "assets"), { + maxAge: '1y', + immutable: true + })); - // fall through to index.html if the file doesn't exist + // Serve other static files with no-cache for HTML + app.use(express.static(distPath, { + setHeaders: (res, filePath) => { + if (filePath.endsWith('.html')) { + res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate'); + } + } + })); + + // fall through to index.html if the file doesn't exist (with no-cache) app.use("*", (_req, res) => { + res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate'); res.sendFile(path.resolve(distPath, "index.html")); }); }