Skip to content

Commit cde4663

Browse files
committed
sort out displaying debugger
1 parent 5dca3ed commit cde4663

File tree

1 file changed

+29
-14
lines changed

1 file changed

+29
-14
lines changed

client/src/App.tsx

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,21 @@ import { useConnection } from "./lib/hooks/useConnection";
3131
import { useDraggablePane } from "./lib/hooks/useDraggablePane";
3232
import { StdErrNotification } from "./lib/notificationTypes";
3333

34-
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
34+
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
3535
import { Button } from "@/components/ui/button";
3636
import {
3737
Bell,
3838
Files,
3939
FolderTree,
4040
Hammer,
4141
Hash,
42+
Key,
4243
MessageSquare,
4344
} from "lucide-react";
4445

4546
import { z } from "zod";
4647
import "./App.css";
47-
const AuthDebugger = React.lazy(() => import("./components/AuthDebugger"));
48+
import AuthDebugger from "./components/AuthDebugger";
4849
import ConsoleTab from "./components/ConsoleTab";
4950
import HistoryAndNotifications from "./components/History";
5051
import PingTab from "./components/PingTab";
@@ -259,21 +260,25 @@ const App = () => {
259260
(serverUrl: string) => {
260261
setSseUrl(serverUrl);
261262
setTransportType("sse");
263+
setIsAuthDebuggerVisible(false);
262264
void connectMcpServer();
263265
},
264266
[connectMcpServer],
265267
);
266268

267269
// Auto-connect to previously saved serverURL after OAuth callback
268-
const onOAuthDebugConnect = useCallback((serverUrl: string, authorizationCode?: string) => {
269-
setIsAuthDebuggerVisible(true);
270-
if (authorizationCode) {
271-
updateAuthState({
272-
authorizationCode,
273-
oauthStep: "token_request",
274-
});
275-
}
276-
}, []);
270+
const onOAuthDebugConnect = useCallback(
271+
(serverUrl: string, authorizationCode?: string) => {
272+
setIsAuthDebuggerVisible(true);
273+
if (authorizationCode) {
274+
updateAuthState({
275+
authorizationCode,
276+
oauthStep: "token_request",
277+
});
278+
}
279+
},
280+
[],
281+
);
277282

278283
// Load OAuth tokens when sseUrl changes
279284
useEffect(() => {
@@ -537,14 +542,14 @@ const App = () => {
537542

538543
// Helper component for rendering the AuthDebugger
539544
const AuthDebuggerWrapper = () => (
540-
<Suspense fallback={<div>Loading...</div>}>
545+
<TabsContent value="auth">
541546
<AuthDebugger
542547
sseUrl={sseUrl}
543548
onBack={() => setIsAuthDebuggerVisible(false)}
544549
authState={authState}
545550
updateAuthState={updateAuthState}
546551
/>
547-
</Suspense>
552+
</TabsContent>
548553
);
549554

550555
// Helper function to render OAuth callback components
@@ -659,6 +664,10 @@ const App = () => {
659664
<FolderTree className="w-4 h-4 mr-2" />
660665
Roots
661666
</TabsTrigger>
667+
<TabsTrigger value="auth">
668+
<Key className="w-4 h-4 mr-2" />
669+
Auth
670+
</TabsTrigger>
662671
</TabsList>
663672

664673
<div className="w-full">
@@ -796,7 +805,13 @@ const App = () => {
796805
</div>
797806
</Tabs>
798807
) : isAuthDebuggerVisible ? (
799-
<AuthDebuggerWrapper />
808+
<Tabs
809+
defaultValue={"auth"}
810+
className="w-full p-4"
811+
onValueChange={(value) => (window.location.hash = value)}
812+
>
813+
<AuthDebuggerWrapper />
814+
</Tabs>
800815
) : (
801816
<div className="flex flex-col items-center justify-center h-full gap-4">
802817
<p className="text-lg text-gray-500">

0 commit comments

Comments
 (0)