Skip to content

Commit 750d70c

Browse files
fix(studio): hide chat panel before login and center auth loading spinner
Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/5fb6f6a0-3113-43a8-be7f-fe05b9313bad Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
1 parent 1584e50 commit 750d70c

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

apps/studio/src/routes/__root.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function RequireAuth({ children }: { children: React.ReactNode }) {
8282

8383
if (loading && !user) {
8484
return (
85-
<div className="flex min-h-screen items-center justify-center bg-background">
85+
<div className="flex min-h-screen w-full flex-1 items-center justify-center bg-background">
8686
<div className="h-8 w-8 animate-spin rounded-full border-4 border-muted border-t-primary" />
8787
</div>
8888
);
@@ -107,6 +107,12 @@ function RequireAuth({ children }: { children: React.ReactNode }) {
107107
return <>{children}</>;
108108
}
109109

110+
function AuthedAiChatPanel() {
111+
const { user } = useSession();
112+
if (!user) return null;
113+
return <AiChatPanel />;
114+
}
115+
110116
function RootComponent() {
111117
const client = useObjectStackClient();
112118

@@ -132,7 +138,7 @@ function RootComponent() {
132138
<Outlet />
133139
</RequireAuth>
134140
<Toaster />
135-
<AiChatPanel />
141+
<AuthedAiChatPanel />
136142
</ProductionGuardProvider>
137143
</SidebarProvider>
138144
</ErrorBoundary>

0 commit comments

Comments
 (0)