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:
+1
-3
@@ -50,10 +50,8 @@ export default async function RootLayout({
|
||||
lang="tr"
|
||||
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)]">
|
||||
<ConsentInit gtmId={gtmId} />
|
||||
{children}
|
||||
<CookieBanner />
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user