From 6dd453340f4cf5ceea44bb034436530dd7a58f35 Mon Sep 17 00:00:00 2001 From: mroops0111 Date: Mon, 15 Jun 2026 23:45:56 +0800 Subject: [PATCH] fix(studio): three sidebar/wizard regressions from multi-remote refactor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three latent bugs introduced by the multi-remote workspace PR (#13, 2026-06-07) that only surfaced once someone tried to use the wizard or G-chord shortcuts post-merge: 1. Sidebar.tsx: G-chord shortcut hint (G C / G P / G H / ...) was hidden by the pending-count badge because the two shared one render slot under a `count === 0` guard. Render both side by side instead; pending counts and shortcut affordance are independent signals. 2. CreateWorkspaceWizard.tsx: `onSuccess` only invalidated the legacy `['workspaces']` query key. The sidebar moved to per-remote `['workspaces-at', remoteId]` keys when remotes shipped but the wizard mutation wasn't updated, so newly-scaffolded workspaces didn't appear until a hard reload. Add the second invalidate. 3. Sidebar.tsx: when collapsed and a remote already had workspaces, the `+ Open workspace` button rendered nowhere — only the non-collapsed header and the collapsed-empty paths had it. Append an icon-only `+` at the end of each remote's collapsed workspace list (matches the Discord rail pattern where the add-server `+` is always visible in icon-only mode). Co-Authored-By: Claude Opus 4.7 (1M context) --- .../src/components/CreateWorkspaceWizard.tsx | 4 ++++ packages/studio/src/components/Sidebar.tsx | 22 +++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/packages/studio/src/components/CreateWorkspaceWizard.tsx b/packages/studio/src/components/CreateWorkspaceWizard.tsx index 623276c..8884250 100644 --- a/packages/studio/src/components/CreateWorkspaceWizard.tsx +++ b/packages/studio/src/components/CreateWorkspaceWizard.tsx @@ -76,6 +76,10 @@ export function CreateWorkspaceWizard({ open, onOpenChange, onCreated }: CreateW onSuccess: (result) => { setIngestResults(result.ingest) queryClient.invalidateQueries({ queryKey: queryKeys.workspaces() }) + // Sidebar reads per-remote via `['workspaces-at', remoteId]`, which is + // a different cache entry from the single-server `['workspaces']` key. + // Without this the newly-scaffolded workspace doesn't appear until reload. + queryClient.invalidateQueries({ queryKey: ['workspaces-at'], exact: false }) onCreated?.(result.workspace.id) }, }) diff --git a/packages/studio/src/components/Sidebar.tsx b/packages/studio/src/components/Sidebar.tsx index 65e14d2..b0b5f43 100644 --- a/packages/studio/src/components/Sidebar.tsx +++ b/packages/studio/src/components/Sidebar.tsx @@ -397,6 +397,23 @@ function RemoteContent({ onOpenDetails={() => onOpenDetails(ws.id)} /> ))} + {collapsed && ( +
  • + + + + + {`Open workspace on ${remote.name}`} + +
  • + )} ) } @@ -628,12 +645,13 @@ function HereRow({ collapsed, icon: Icon, label, active, count = 0, shortcut, on shortcut?: string onClick: () => void }) { + const collapsedTitle = [label, count > 0 ? `(${count})` : null, shortcut].filter(Boolean).join(' ') return ( 0 ? `${label} (${count})` : label, className: 'justify-center px-0 py-1' } : {})} + {...(collapsed ? { title: collapsedTitle, className: 'justify-center px-0 py-1' } : {})} > {collapsed ? ( @@ -664,7 +682,7 @@ function HereRow({ collapsed, icon: Icon, label, active, count = 0, shortcut, on {count} )} - {shortcut && count === 0 && ( + {shortcut && (