fix: sync run button state with terminal process via centralized exit tracking

Centralize terminal process lifecycle in terminal-context as single
source of truth. TerminalView reports exit/failure via callback,
context maintains exitedTerminals set, command-dropdown reacts to it.

Removes redundant polling and per-component exit event subscriptions
that raced with deferred spawn introduced in b2d10fa.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
xintaofei
2026-04-02 19:02:01 +08:00
parent ef94687c87
commit e7bd12e16f
4 changed files with 94 additions and 116 deletions

View File

@@ -5,7 +5,7 @@ import { TerminalTabBar } from "./terminal-tab-bar"
import { TerminalView } from "./terminal-view"
export function TerminalPanel() {
const { isOpen, tabs, activeTabId } = useTerminalContext()
const { isOpen, tabs, activeTabId, markTerminalExited } = useTerminalContext()
return (
<section
@@ -22,6 +22,7 @@ export function TerminalPanel() {
initialCommand={tab.initialCommand}
isActive={tab.id === activeTabId}
isVisible={isOpen}
onProcessExited={markTerminalExited}
/>
))}
</div>