From 08f2a01057362473fda1c95da2127a0107d646e2 Mon Sep 17 00:00:00 2001 From: hsiegeln <37154749+hsiegeln@users.noreply.github.com> Date: Sat, 4 Apr 2026 15:47:48 +0200 Subject: [PATCH] fix: always show environment selector in TopBar Use unfiltered agent query to discover environments (avoids circular filter). Always show selector even with single environment so it's visible as a label. Default to ['default'] when no agents connected. Co-Authored-By: Claude Opus 4.6 (1M context) --- ui/src/components/LayoutShell.tsx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ui/src/components/LayoutShell.tsx b/ui/src/components/LayoutShell.tsx index 3f936335..543ffe02 100644 --- a/ui/src/components/LayoutShell.tsx +++ b/ui/src/components/LayoutShell.tsx @@ -291,18 +291,19 @@ function LayoutContent() { }, [setSearchParams]); const { data: catalog } = useRouteCatalog(timeRange.start.toISOString(), timeRange.end.toISOString(), selectedEnv); - const { data: agents } = useAgents(undefined, undefined, selectedEnv); + const { data: allAgents } = useAgents(); // unfiltered — for environment discovery + const { data: agents } = useAgents(undefined, undefined, selectedEnv); // filtered — for sidebar/search const { data: attributeKeys } = useAttributeKeys(); - // Extract distinct environments from agents + // Extract distinct environments from ALL agents (not filtered by selected env) const environments: string[] = useMemo(() => { - if (!agents) return []; + if (!allAgents) return ['default']; const envSet = new Set(); - for (const a of agents as any[]) { - if (a.environmentId) envSet.add(a.environmentId); + for (const a of allAgents as any[]) { + envSet.add(a.environmentId || 'default'); } return [...envSet].sort(); - }, [agents]); + }, [allAgents]); // --- Admin search data (only fetched on admin pages) ---------------- const isAdminPage = location.pathname.startsWith('/admin'); @@ -702,13 +703,13 @@ function LayoutContent() { 0 ? ( + environment={ - ) : undefined} + } user={username ? { name: username } : undefined} onLogout={handleLogout} />