mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(frontend): use dynamic import and gate Agentation to local/dev only
- Switch from static to dynamic import for proper tree-shaking in production - Gate rendering behind isLocal || isDev using environment service
This commit is contained in:
@@ -12,8 +12,13 @@ import { Toaster } from "@/components/molecules/Toast/toaster";
|
||||
import { SetupAnalytics } from "@/services/analytics";
|
||||
import { VercelAnalyticsWrapper } from "@/services/analytics/VercelAnalyticsWrapper";
|
||||
import { environment } from "@/services/environment";
|
||||
import { Agentation } from "agentation";
|
||||
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();
|
||||
@@ -79,7 +84,8 @@ export default async function RootLayout({
|
||||
</div>
|
||||
<Toaster />
|
||||
<CookieConsentBanner />
|
||||
{process.env.NEXT_PUBLIC_AGENTATION_DEVTOOL && <Agentation />}
|
||||
{(isLocal || isDev) &&
|
||||
process.env.NEXT_PUBLIC_AGENTATION_DEVTOOL && <Agentation />}
|
||||
</Providers>
|
||||
</ErrorBoundary>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user