mirror of
https://github.com/stablyai/orca.git
synced 2026-10-12 16:03:03 +00:00
fix(resource-usage): skip kill-confirm dialog for orphan sessions
Orphan sessions have no tab in this Orca instance, so there's no "unsaved work in that pane" risk that justifies the confirm step. Clicking the X on an orphan now optimistically removes the row and fires pty.kill straight away — same UX as the bulk Kill orphan terminals button. Bound sessions still confirm because killing them takes a tab the user is actively working in. Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -861,9 +861,25 @@ export function ResourceUsageStatusSegment({
|
||||
void runSleepWorktree(id)
|
||||
}, [])
|
||||
|
||||
const handleKillSession = useCallback((session: UnifiedSessionRow): void => {
|
||||
setKillConfirm(session)
|
||||
}, [])
|
||||
const handleKillSession = useCallback(
|
||||
(session: UnifiedSessionRow): void => {
|
||||
// Why: orphan sessions have no tab in this Orca instance, so there's
|
||||
// no "unsaved work in that pane" the user could lose by killing them.
|
||||
// Skip the confirm dialog for orphans and fire the kill straight away
|
||||
// (with optimistic removal) — same UX as a one-off kill from the
|
||||
// bulk "Kill orphan terminals" button. Bound sessions still confirm.
|
||||
if (!session.bound) {
|
||||
setSessions((prev) => prev.filter((s) => s.id !== session.sessionId))
|
||||
void window.api.pty.kill(session.sessionId).catch(() => {
|
||||
/* already dead */
|
||||
})
|
||||
void refreshSessions()
|
||||
return
|
||||
}
|
||||
setKillConfirm(session)
|
||||
},
|
||||
[refreshSessions]
|
||||
)
|
||||
|
||||
const handleKillOrphans = useCallback(async () => {
|
||||
if (!workspaceSessionReady) {
|
||||
|
||||
Reference in New Issue
Block a user