fix: pass locale explicitly to Hero and force-dynamic on locale-sensitive API routes
All checks were successful
CI / CD / test-build (push) Successful in 10m11s
CI / CD / deploy-dev (push) Has been skipped
CI / CD / deploy-production (push) Successful in 1m28s

- 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 <noreply@anthropic.com>
This commit is contained in:
2026-03-08 13:43:26 +01:00
parent c95fc3101b
commit 48a29cd872
3 changed files with 6 additions and 3 deletions

View File

@@ -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

View File

@@ -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) {

View File

@@ -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 (
<section className="relative min-h-screen flex flex-col items-center justify-center bg-stone-50 dark:bg-stone-950 px-6 transition-colors duration-500">