From 28d3fc56c17378840233946e68c87a9a92950282 Mon Sep 17 00:00:00 2001 From: Richard Michael Date: Wed, 23 Jul 2025 14:38:38 -0700 Subject: [PATCH] Update URL fragment to only appear when connected MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Only set URL fragment when mcpClient is connected - Set default fragment based on server capabilities priority (resources > prompts > tools > ping) - Clear fragment when disconnected to prevent stale routing state 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- client/src/App.tsx | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/client/src/App.tsx b/client/src/App.tsx index c4c89564..3836aa9b 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -465,10 +465,24 @@ const App = () => { }, [roots]); useEffect(() => { - if (!window.location.hash) { - window.location.hash = "resources"; + if (mcpClient && !window.location.hash) { + const defaultTab = serverCapabilities?.resources + ? "resources" + : serverCapabilities?.prompts + ? "prompts" + : serverCapabilities?.tools + ? "tools" + : "ping"; + window.location.hash = defaultTab; + } else if (!mcpClient && window.location.hash) { + // Clear hash when disconnected - completely remove the fragment + window.history.replaceState( + null, + "", + window.location.pathname + window.location.search, + ); } - }, []); + }, [mcpClient, serverCapabilities]); useEffect(() => { const handleHashChange = () => {