AI tracker: owner-only tabs no longer 500 (cache-control set twice: layout + page load)
All checks were successful
Deploy production / deploy (push) Successful in 1m14s

This commit is contained in:
2026-10-26 09:27:26 +00:00
parent 22279d181f
commit 7396d23335
3 changed files with 6 additions and 3 deletions

View File

@@ -4,8 +4,9 @@ import type { PageServerLoad } from './$types';
// Owner only: one row per Grok Bot agent, short summaries written by Daisy (no transcripts).
export const load: PageServerLoad = async (event) => {
// cache-control comes from the ai layout (owner) and hooks.server.ts; setting it here too threw
// header_already_set (500) for the owner.
requireOwner(event);
event.setHeaders({ 'cache-control': 'private, no-store' });
return {
bots: await loadBots(),
now: Date.now(),

View File

@@ -15,8 +15,9 @@ import type { Actions, PageServerLoad, RequestEvent } from './$types';
// Actions don't run the load, so each one checks the owner again (hooks.server.ts also 404s
// this path for everyone else).
export const load: PageServerLoad = async (event) => {
// No setHeaders here: the ai layout already sets cache-control for the owner (setting it
// twice throws), and hooks.server.ts adds private, no-store on owner-only paths.
requireOwner(event);
event.setHeaders({ 'cache-control': 'private, no-store' });
return {
providers: await loadSetup(),
now: Date.now(),

View File

@@ -6,8 +6,9 @@ import type { Actions, PageServerLoad } from './$types';
// Owner only: dated usage numbers per provider. Actions don't run the load, so each
// action checks the owner again (hooks.server.ts also 404s this path for everyone else).
export const load: PageServerLoad = async (event) => {
// cache-control comes from the ai layout (owner) and hooks.server.ts; setting it here too threw
// header_already_set (500) for the owner.
requireOwner(event);
event.setHeaders({ 'cache-control': 'private, no-store' });
return {
entries: await loadUsage(),
seo: { title: 'AI tracker · usage', description: 'My AI usage.', index: false }