Skip to content

Commit 8b57fc3

Browse files
Merge pull request #1195 from objectstack-ai/copilot/remove-chat-button-before-login
fix(studio): hide AI chat panel before login and center auth loading spinner
2 parents 1584e50 + 750d70c commit 8b57fc3

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)