From 48a29cd87212ca0c9a83b67f07a3807f6b532439 Mon Sep 17 00:00:00 2001 From: denshooter Date: Sun, 8 Mar 2026 13:43:26 +0100 Subject: [PATCH] fix: pass locale explicitly to Hero and force-dynamic on locale-sensitive API routes - Hero.tsx: pass locale prop directly to getTranslations instead of relying on setRequestLocale async storage, which can be lost during Next.js RSC streaming - book-reviews route: replace revalidate=300 with force-dynamic to prevent cached English responses being served to German locale requests - content/page route: add runtime=nodejs and force-dynamic (was missing both, violating CLAUDE.md API route conventions) Co-Authored-By: Claude Sonnet 4.6 --- app/api/book-reviews/route.ts | 2 +- app/api/content/page/route.ts | 3 +++ app/components/Hero.tsx | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/api/book-reviews/route.ts b/app/api/book-reviews/route.ts index 549ae66..4a5a31d 100644 --- a/app/api/book-reviews/route.ts +++ b/app/api/book-reviews/route.ts @@ -3,7 +3,7 @@ import { getBookReviews } from '@/lib/directus'; import { checkRateLimit, getClientIp } from '@/lib/auth'; export const runtime = 'nodejs'; -export const revalidate = 300; +export const dynamic = 'force-dynamic'; const CACHE_TTL = 300; // 5 minutes diff --git a/app/api/content/page/route.ts b/app/api/content/page/route.ts index 4bdab1c..db35864 100644 --- a/app/api/content/page/route.ts +++ b/app/api/content/page/route.ts @@ -3,6 +3,9 @@ import { getContentByKey } from "@/lib/content"; import { getContentPage } from "@/lib/directus"; import { richTextToSafeHtml } from "@/lib/richtext"; +export const runtime = 'nodejs'; +export const dynamic = 'force-dynamic'; + const CACHE_TTL = 300; // 5 minutes export async function GET(request: NextRequest) { diff --git a/app/components/Hero.tsx b/app/components/Hero.tsx index 9337184..125cbb5 100644 --- a/app/components/Hero.tsx +++ b/app/components/Hero.tsx @@ -5,8 +5,8 @@ interface HeroProps { locale: string; } -export default async function Hero({ locale: _locale }: HeroProps) { - const t = await getTranslations("home.hero"); +export default async function Hero({ locale }: HeroProps) { + const t = await getTranslations({ locale, namespace: "home.hero" }); return (