diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 9eca3786..c07702de 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,5 +1,5 @@ import type { Metadata } from 'next'; -import { cookies } from 'next/headers'; +import { cookies, headers } from 'next/headers'; import { Geist, Geist_Mono } from 'next/font/google'; import Script from 'next/script'; import './globals.css'; @@ -49,9 +49,10 @@ export default async function RootLayout({ }: Readonly<{ children: React.ReactNode; }>) { - const cookieStore = await cookies(); + const [cookieStore, headersList] = await Promise.all([cookies(), headers()]); const themeCookie = cookieStore.get('theme'); const defaultTheme = themeCookie ? themeCookie.value : 'system'; + const cspNonce = headersList.get('x-csp-nonce') ?? ''; // Read persisted locale to server-render the correct lang/dir on — // avoids a hydration flash for RTL users. @@ -80,7 +81,7 @@ export default async function RootLayout({ return (
- +