AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
hotfix(frontend): fix home redirect (3) (#11904)
Ubbecc4839bedb62
diff --git a/autogpt_platform/frontend/src/app/page.tsx b/autogpt_platform/frontend/src/app/page.tsxindex 88e4e21644..ce67760eda 100644--- a/autogpt_platform/frontend/src/app/page.tsx+++ b/autogpt_platform/frontend/src/app/page.tsx@@ -1,11 +1,15 @@-import { redirect } from "next/navigation";--/**- * Root page always redirects to /copilot.- * The /copilot page handles the feature flag check and redirects to /library if needed.- * This single-check approach avoids race conditions with LaunchDarkly initialization.- * See: SECRT-1845- */+"use client";++import { LoadingSpinner } from "@/components/atoms/LoadingSpinner/LoadingSpinner";+import { useRouter } from "next/navigation";+import { useEffect } from "react";+export default function Page() {- redirect("/copilot");+ const router = useRouter();++ useEffect(() => {+ router.replace("/copilot");+ }, [router]);++ return <LoadingSpinner size="large" cover />;}diff --git a/autogpt_platform/frontend/src/services/feature-flags/feature-flag-provider.tsx b/autogpt_platform/frontend/src/services/feature-flags/feature-flag-provider.tsxindex 9e1c812e85..da073816ac 100644--- a/autogpt_platform/frontend/src/services/feature-flags/feature-flag-provider.tsx+++ b/autogpt_platform/frontend/src/services/feature-flags/feature-flag-provider.tsx@@ -1,5 +1,6 @@"use client";+import { LoadingSpinner } from "@/components/atoms/LoadingSpinner/LoadingSpinner";import { useSupabase } from "@/lib/supabase/hooks/useSupabase";import * as Sentry from "@sentry/nextjs";import { LDProvider } from "launchdarkly-react-client-sdk";@@ -15,7 +16,9 @@ export function LaunchDarklyProvider({ children }: { children: ReactNode }) {const clientId = environment.getLaunchDarklyClientId();const context = useMemo(() => {- if (isUserLoading || !user) {+ if (isUserLoading) return;++ if (!user) {return {kind: "user" as const,key: "anonymous",@@ -38,6 +41,10 @@ export function LaunchDarklyProvider({ children }: { children: ReactNode }) {return <>{children}</>;}+ if (isUserLoading) {+ return <LoadingSpinner size="large" cover />;+ }+return (<LDProviderclientSideID={clientId ?? ""}