diff --git a/frontend/src/app/auth/callback/page.tsx b/frontend/src/app/auth/callback/page.tsx index 8c1683cf..f37b8768 100644 --- a/frontend/src/app/auth/callback/page.tsx +++ b/frontend/src/app/auth/callback/page.tsx @@ -6,6 +6,7 @@ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/com import { Button } from "@/components/ui/button" import { Loader2, CheckCircle, XCircle, ArrowLeft } from "lucide-react" import { useAuth } from "@/contexts/auth-context" +import AnimatedProcessingIcon from "@/components/ui/animated-processing-icon" function AuthCallbackContent() { const router = useRouter() @@ -164,7 +165,9 @@ function AuthCallbackContent() { {status === "processing" && ( <> - + {getTitle()} )} diff --git a/frontend/src/components/layout-wrapper.tsx b/frontend/src/components/layout-wrapper.tsx index 36713e74..43e6c05a 100644 --- a/frontend/src/components/layout-wrapper.tsx +++ b/frontend/src/components/layout-wrapper.tsx @@ -12,6 +12,7 @@ import { useTask } from "@/contexts/task-context"; import { cn } from "@/lib/utils"; import { useDoclingHealthQuery } from "@/src/app/api/queries/useDoclingHealthQuery"; import { ChatRenderer } from "./chat-renderer"; +import AnimatedProcessingIcon from "./ui/animated-processing-icon"; export function LayoutWrapper({ children }: { children: React.ReactNode }) { const pathname = usePathname(); @@ -19,18 +20,29 @@ export function LayoutWrapper({ children }: { children: React.ReactNode }) { const { isPanelOpen } = useKnowledgeFilter(); const { isLoading, isAuthenticated, isNoAuthMode } = useAuth(); + // List of paths that should not show navigation + const authPaths = ["/login", "/auth/callback"]; + const isAuthPage = authPaths.includes(pathname); + + // Call all hooks unconditionally (React rules) + // But disable queries for auth pages to prevent unnecessary requests const { data: settings, isLoading: isSettingsLoading } = useGetSettingsQuery({ - enabled: isAuthenticated || isNoAuthMode, + enabled: !isAuthPage && (isAuthenticated || isNoAuthMode), }); const { data: health, isLoading: isHealthLoading, isError, - } = useDoclingHealthQuery(); + } = useDoclingHealthQuery({ + enabled: !isAuthPage, + }); + + // For auth pages, render immediately without navigation + // This prevents the main layout from flashing + if (isAuthPage) { + return
{children}
; + } - // List of paths that should not show navigation - const authPaths = ["/login", "/auth/callback"]; - const isAuthPage = authPaths.includes(pathname); const isOnKnowledgePage = pathname.startsWith("/knowledge"); const isUnhealthy = health?.status === "unhealthy" || isError; @@ -42,18 +54,13 @@ export function LayoutWrapper({ children }: { children: React.ReactNode }) { return (
- +

Starting OpenRAG...

); } - if (isAuthPage) { - // For auth pages, render without navigation - return
{children}
; - } - // For all other pages, render with Langflow-styled navigation and task menu return (