diff --git a/web/src/components/sidebar/Sidebar.tsx b/web/src/components/sidebar/Sidebar.tsx index c0a520c..f36795b 100644 --- a/web/src/components/sidebar/Sidebar.tsx +++ b/web/src/components/sidebar/Sidebar.tsx @@ -333,10 +333,25 @@ export function Sidebar(props: SidebarProps) { onCancel={() => setKill(null)} onConfirm={async () => { const { session: s, force } = kill; + // Close the dialog immediately and optimistically remove the + // session from the sidebar so the operator isn't staring at a + // spinner while the daemon tears down the tmux session. + setKill(null); + const store = props.store; + if (store) { + const next = new Map(store.getState().sessions); + next.delete(s.id); + store.setState({ sessions: next }); + } try { await killSession(s.id, force); - setKill(null); } catch (e: unknown) { + // Restore the session so it reappears in the sidebar. + if (store) { + const restored = new Map(store.getState().sessions); + restored.set(s.id, s); + store.setState({ sessions: restored }); + } // The daemon refuses an unforced kill over a worktree holding // unsaved work; that refusal needs its own prompt // (docs/WORKTREES.md). @@ -349,7 +364,8 @@ export function Sidebar(props: SidebarProps) { }); return; } - throw e; + // Nothing else we can usefully show — the session is back in + // the sidebar and the operator can retry. } }} />