fix(frontend): move Agentation dynamic import to client component

ssr: false in next/dynamic is not allowed in Server Components.
Extract into a 'use client' wrapper component.
This commit is contained in:
abhi1992002
2026-04-03 09:07:32 +05:30
parent 060b96818d
commit 1d882e3e71
2 changed files with 16 additions and 7 deletions

View File

@@ -12,13 +12,8 @@ import { Toaster } from "@/components/molecules/Toast/toaster";
import { SetupAnalytics } from "@/services/analytics";
import { VercelAnalyticsWrapper } from "@/services/analytics/VercelAnalyticsWrapper";
import { environment } from "@/services/environment";
import AgentationDevtool from "@/components/AgentationDevtool";
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
import dynamic from "next/dynamic";
const Agentation = dynamic(
() => import("agentation").then((mod) => mod.Agentation),
{ ssr: false },
);
import { headers } from "next/headers";
const isDev = environment.isDev();
@@ -85,7 +80,9 @@ export default async function RootLayout({
<Toaster />
<CookieConsentBanner />
{(isLocal || isDev) &&
process.env.NEXT_PUBLIC_AGENTATION_DEVTOOL && <Agentation />}
process.env.NEXT_PUBLIC_AGENTATION_DEVTOOL && (
<AgentationDevtool />
)}
</Providers>
</ErrorBoundary>
</body>

View File

@@ -0,0 +1,12 @@
"use client";
import dynamic from "next/dynamic";
const Agentation = dynamic(
() => import("agentation").then((mod) => mod.Agentation),
{ ssr: false },
);
export default function AgentationDevtool() {
return <Agentation />;
}