fix: move ShaderGradientBackground dynamic import into client wrapper
next/dynamic with ssr:false is not allowed in Server Components. Follows existing BackgroundBlobsClient pattern. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
16
app/components/ShaderGradientBackgroundClient.tsx
Normal file
16
app/components/ShaderGradientBackgroundClient.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
"use client";
|
||||
|
||||
import React, { useEffect, useState } from "react";
|
||||
import ShaderGradientBackground from "./ShaderGradientBackground";
|
||||
|
||||
export default function ShaderGradientBackgroundClient() {
|
||||
const [mounted, setMounted] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
setMounted(true);
|
||||
}, []);
|
||||
|
||||
if (!mounted) return null;
|
||||
|
||||
return <ShaderGradientBackground />;
|
||||
}
|
||||
@@ -2,16 +2,11 @@ import "./globals.css";
|
||||
import { Metadata } from "next";
|
||||
import { Inter, Playfair_Display } from "next/font/google";
|
||||
import React from "react";
|
||||
import dynamic from "next/dynamic";
|
||||
import ClientProviders from "./components/ClientProviders";
|
||||
import ShaderGradientBackgroundClient from "./components/ShaderGradientBackgroundClient";
|
||||
import { cookies } from "next/headers";
|
||||
import { getBaseUrl } from "@/lib/seo";
|
||||
|
||||
const ShaderGradientBackground = dynamic(
|
||||
() => import("./components/ShaderGradientBackground"),
|
||||
{ ssr: false, loading: () => null }
|
||||
);
|
||||
|
||||
const inter = Inter({
|
||||
variable: "--font-inter",
|
||||
subsets: ["latin"],
|
||||
@@ -41,7 +36,7 @@ export default async function RootLayout({
|
||||
</head>
|
||||
<body className={`${inter.variable} ${playfair.variable}`} suppressHydrationWarning>
|
||||
<div className="grain-overlay" aria-hidden="true" />
|
||||
<ShaderGradientBackground />
|
||||
<ShaderGradientBackgroundClient />
|
||||
<ClientProviders>{children}</ClientProviders>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user