Compare commits
1
Commits
animato-2
...
dominant-2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c27a897ac |
@@ -333,10 +333,25 @@ export function Sidebar(props: SidebarProps) {
|
|||||||
onCancel={() => setKill(null)}
|
onCancel={() => setKill(null)}
|
||||||
onConfirm={async () => {
|
onConfirm={async () => {
|
||||||
const { session: s, force } = kill;
|
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 {
|
try {
|
||||||
await killSession(s.id, force);
|
await killSession(s.id, force);
|
||||||
setKill(null);
|
|
||||||
} catch (e: unknown) {
|
} 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
|
// The daemon refuses an unforced kill over a worktree holding
|
||||||
// unsaved work; that refusal needs its own prompt
|
// unsaved work; that refusal needs its own prompt
|
||||||
// (docs/WORKTREES.md).
|
// (docs/WORKTREES.md).
|
||||||
@@ -349,7 +364,8 @@ export function Sidebar(props: SidebarProps) {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw e;
|
// Nothing else we can usefully show — the session is back in
|
||||||
|
// the sidebar and the operator can retry.
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user