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 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user