fix(server): no-store Cache-Control on hub HTML pages

Browsers were caching /board and /team, so a stale page kept showing old
markup and didn't reflect live task/agent state (looked like the pre-redesign
team page + tasks appearing unclaimed though the server had them claimed).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
chahinebrini 2026-07-08 03:37:25 +02:00
parent 7ca6c859f2
commit 8dbbd0d10c

View File

@ -36,6 +36,16 @@ function wantsHtml(request: { headers: { accept?: string } }): boolean {
} }
export async function registerRoutes(app: FastifyInstance, cwd: string): Promise<void> { export async function registerRoutes(app: FastifyInstance, cwd: string): Promise<void> {
// Never let a browser cache a hub HTML page — otherwise a stale board/team
// page keeps showing old markup and doesn't reflect live task/agent state.
app.addHook('onSend', async (_request, reply, payload) => {
const ct = reply.getHeader('content-type');
if (typeof ct === 'string' && ct.includes('text/html')) {
reply.header('Cache-Control', 'no-store, must-revalidate');
}
return payload;
});
// Static, self-contained Trello-like board. Polls /tasks, /handoffs and // Static, self-contained Trello-like board. Polls /tasks, /handoffs and
// /decisions on the same origin; no build step, no deps. Cached once — the // /decisions on the same origin; no build step, no deps. Cached once — the
// markup is constant, only the data it fetches changes. // markup is constant, only the data it fetches changes.