mirror of
https://github.com/stablyai/orca.git
synced 2026-10-20 00:03:45 +00:00
fix: remount terminal panes after shutdown to restore PTY connections (#73)
When all PTYs are dead after shutdown, bump a generation counter on terminal tabs so React remounts TerminalPane components with fresh PTY connections instead of showing stale terminals. Also converts interfaces to type aliases in types.ts to satisfy linter. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
9853bba8ba
commit
82425df6ea
@@ -386,7 +386,7 @@ export default function Terminal(): React.JSX.Element | null {
|
||||
>
|
||||
{worktreeTabs.map((tab) => (
|
||||
<TerminalPane
|
||||
key={tab.id}
|
||||
key={`${tab.id}-${tab.generation ?? 0}`}
|
||||
tabId={tab.id}
|
||||
worktreeId={worktree.id}
|
||||
cwd={worktree.path}
|
||||
|
||||
@@ -235,6 +235,24 @@ export const createWorktreeSlice: StateCreator<AppState, [], [], WorktreeSlice>
|
||||
}
|
||||
})
|
||||
|
||||
// If the worktree has tabs but all PTYs are dead (e.g. after shutdown),
|
||||
// bump generation so TerminalPanes remount with fresh PTY connections.
|
||||
if (worktreeId) {
|
||||
const tabs = get().tabsByWorktree[worktreeId] ?? []
|
||||
const allDead = tabs.length > 0 && tabs.every((tab) => !tab.ptyId)
|
||||
if (allDead) {
|
||||
set((s) => ({
|
||||
tabsByWorktree: {
|
||||
...s.tabsByWorktree,
|
||||
[worktreeId]: (s.tabsByWorktree[worktreeId] ?? []).map((tab) => ({
|
||||
...tab,
|
||||
generation: (tab.generation ?? 0) + 1
|
||||
}))
|
||||
}
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
// Refresh GitHub data (PR + issue status) when switching to a different worktree
|
||||
if (worktreeId && worktreeId !== prevActiveId) {
|
||||
get().refreshGitHubForWorktree(worktreeId)
|
||||
|
||||
Reference in New Issue
Block a user