mirror of
https://github.com/stablyai/orca.git
synced 2026-10-18 00:03:20 +00:00
Prevent reclaiming terminal if PTY ID does not match current pane
Avoid restoring a terminal with a stale PTY ID if a different terminal has already reused the pane slot. Trigger a state override tick to make stale portals disappear instead.
This commit is contained in:
@@ -2267,8 +2267,13 @@ export default function TerminalPane({
|
||||
async (pane: ManagedPane, ptyId: string): Promise<void> => {
|
||||
// Why: local and remote runtime PTYs use different transports, but the
|
||||
// desktop reclaim button should have one visible recovery behavior.
|
||||
// Why: the banner was rendered for this PTY; re-reading pane transport
|
||||
// after a mobile disconnect race can restore a recycled pane instead.
|
||||
// Why: the banner was rendered for this PTY; stale portals must disappear
|
||||
// before they can reclaim a different terminal that reused this pane slot.
|
||||
const currentPtyId = paneTransportsRef.current.get(pane.id)?.getPtyId() ?? null
|
||||
if (currentPtyId !== ptyId) {
|
||||
setOverrideTick((n) => n + 1)
|
||||
return
|
||||
}
|
||||
const restored = await restoreTerminalFitToDesktop(ptyId, settingsRef.current ?? undefined)
|
||||
if (restored) {
|
||||
scheduleRestoredTerminalRefit()
|
||||
|
||||
Reference in New Issue
Block a user