From 8235165af5be9b788878eb45e720ecb7bb1541b3 Mon Sep 17 00:00:00 2001 From: maxitect Date: Fri, 13 Nov 2026 00:40:51 +0000 Subject: [PATCH 1/3] perf(headers): send Payload's colour-scheme client hint on the admin only --- next.config.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/next.config.ts b/next.config.ts index 4e64ad1..3a433ca 100644 --- a/next.config.ts +++ b/next.config.ts @@ -29,4 +29,16 @@ const nextConfig: NextConfig = { }, }; -export default withPayload(nextConfig); +const payloadConfig = withPayload(nextConfig); +const payloadHeaders = payloadConfig.headers; + +// Payload asks every page for the Sec-CH-Prefers-Color-Scheme hint, and Critical-CH makes +// Chrome repeat a first visit's document request. Only the admin reads the hint. +payloadConfig.headers = async () => + ((await payloadHeaders?.()) ?? []).map((rule) => + rule.headers.some(({ key }) => key === "Critical-CH") + ? { ...rule, source: "/admin/:path*" } + : rule, + ); + +export default payloadConfig; From 66e858f16dc27a8fec647f43cfb9756d4620e8dc Mon Sep 17 00:00:00 2001 From: maxitect Date: Fri, 13 Nov 2026 00:40:56 +0000 Subject: [PATCH 2/3] perf(fonts): stop preloading Goudy on the public site, which never uses it --- src/app/(frontend)/globals.css | 1 - src/app/(frontend)/layout.tsx | 7 ------- 2 files changed, 8 deletions(-) diff --git a/src/app/(frontend)/globals.css b/src/app/(frontend)/globals.css index dad0068..b8decdc 100644 --- a/src/app/(frontend)/globals.css +++ b/src/app/(frontend)/globals.css @@ -33,7 +33,6 @@ --font-jost: var(--next-font-jost), sans-serif; --font-blanch: var(--next-font-blanch); --font-damion: var(--next-font-damion), cursive; - --font-goudy: var(--next-font-goudy); } @layer base { diff --git a/src/app/(frontend)/layout.tsx b/src/app/(frontend)/layout.tsx index 9d22d00..476f5ce 100644 --- a/src/app/(frontend)/layout.tsx +++ b/src/app/(frontend)/layout.tsx @@ -29,12 +29,6 @@ const blanchCaps = localFont({ display: "swap", }); -const goudyStd = localFont({ - src: "../../fonts/GoudyStd-Heavyface.woff2", - variable: "--next-font-goudy", - display: "swap", -}); - export const metadata: Metadata = { metadataBase: new URL("https://clarksbowlingclub.com"), title: { @@ -63,7 +57,6 @@ export default async function RootLayout({ ${damion.variable} ${jost.variable} ${blanchCaps.variable} - ${goudyStd.variable} antialiased `} From a4c7c548fe2e4e6ac6a16d5230a6851dad4c819b Mon Sep 17 00:00:00 2001 From: maxitect Date: Fri, 13 Nov 2026 00:55:09 +0000 Subject: [PATCH 3/3] fix(headers): fail the build if withPayload stops sending Critical-CH --- next.config.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/next.config.ts b/next.config.ts index 3a433ca..515e41c 100644 --- a/next.config.ts +++ b/next.config.ts @@ -34,11 +34,18 @@ const payloadHeaders = payloadConfig.headers; // Payload asks every page for the Sec-CH-Prefers-Color-Scheme hint, and Critical-CH makes // Chrome repeat a first visit's document request. Only the admin reads the hint. -payloadConfig.headers = async () => - ((await payloadHeaders?.()) ?? []).map((rule) => - rule.headers.some(({ key }) => key === "Critical-CH") - ? { ...rule, source: "/admin/:path*" } - : rule, +payloadConfig.headers = async () => { + const rules = (await payloadHeaders?.()) ?? []; + const isClientHintRule = (rule: (typeof rules)[number]) => + rule.headers.some(({ key }) => key.toLowerCase() === "critical-ch"); + if (!rules.some(isClientHintRule)) { + throw new Error( + "withPayload no longer sends Critical-CH: review the admin-only re-scope in next.config.ts", + ); + } + return rules.map((rule) => + isClientHintRule(rule) ? { ...rule, source: "/admin/:path*" } : rule, ); +}; export default payloadConfig;