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
All checks were successful
Deploy production / deploy (push) Successful in 1m14s
This commit is contained in:
@@ -4,8 +4,9 @@ import type { PageServerLoad } from './$types';
|
|||||||
|
|
||||||
// Owner only: one row per Grok Bot agent, short summaries written by Daisy (no transcripts).
|
// Owner only: one row per Grok Bot agent, short summaries written by Daisy (no transcripts).
|
||||||
export const load: PageServerLoad = async (event) => {
|
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);
|
requireOwner(event);
|
||||||
event.setHeaders({ 'cache-control': 'private, no-store' });
|
|
||||||
return {
|
return {
|
||||||
bots: await loadBots(),
|
bots: await loadBots(),
|
||||||
now: Date.now(),
|
now: Date.now(),
|
||||||
|
|||||||
@@ -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
|
// Actions don't run the load, so each one checks the owner again (hooks.server.ts also 404s
|
||||||
// this path for everyone else).
|
// this path for everyone else).
|
||||||
export const load: PageServerLoad = async (event) => {
|
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);
|
requireOwner(event);
|
||||||
event.setHeaders({ 'cache-control': 'private, no-store' });
|
|
||||||
return {
|
return {
|
||||||
providers: await loadSetup(),
|
providers: await loadSetup(),
|
||||||
now: Date.now(),
|
now: Date.now(),
|
||||||
|
|||||||
@@ -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
|
// 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).
|
// action checks the owner again (hooks.server.ts also 404s this path for everyone else).
|
||||||
export const load: PageServerLoad = async (event) => {
|
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);
|
requireOwner(event);
|
||||||
event.setHeaders({ 'cache-control': 'private, no-store' });
|
|
||||||
return {
|
return {
|
||||||
entries: await loadUsage(),
|
entries: await loadUsage(),
|
||||||
seo: { title: 'AI tracker · usage', description: 'My AI usage.', index: false }
|
seo: { title: 'AI tracker · usage', description: 'My AI usage.', index: false }
|
||||||
|
|||||||
Reference in New Issue
Block a user