fix: ConsentInit'i <head>'den <body>'e taşı (Next.js 16 uyumu)

Hata:
> Encountered a script tag while rendering React component.
> Scripts inside React components are never executed when rendering on the client.

Sebep:
Next.js 16 React 19'da next/script'i <head> içine koyamıyoruz. Script'ler
body içinde render edilmeli — Next.js zaten doğru yere yerleştiriyor.

Çözüm:
ConsentInit'i app/layout.tsx içinde <head>'den çıkardık, body'nin
ilk elementi olarak koyduk. beforeInteractive strategy hala çalışıyor
(Next.js doğru sırayı yönetiyor).
This commit is contained in:
Ege Can Komur
2026-05-20 18:49:15 +03:00
parent e45c44721f
commit 9d74cceb69
+1 -3
View File
@@ -50,10 +50,8 @@ export default async function RootLayout({
lang="tr" lang="tr"
className={`${poppins.variable} ${geistMono.variable} h-full antialiased`} className={`${poppins.variable} ${geistMono.variable} h-full antialiased`}
> >
<head>
<ConsentInit gtmId={gtmId} />
</head>
<body className="min-h-full flex flex-col bg-white text-[var(--foreground)]"> <body className="min-h-full flex flex-col bg-white text-[var(--foreground)]">
<ConsentInit gtmId={gtmId} />
{children} {children}
<CookieBanner /> <CookieBanner />
</body> </body>