Files
orca/src/preload/close-active-tab-payload-admission.ts
T
Jinjing 2214d29f15 fix(browser): close guest-owned split tab (#17281)
* fix(browser): close guest-owned split tab

* fix: check sourceId before toggling floating panel on close

The empty-panel toggle is the ambient fallback only. Guest-initiated
closes (with sourceId) target the main workspace and should not toggle
the panel.

* test(browser-split-shortcuts): remove terminal-mirrors close test and un

Removes test case that verified Cmd+W closes guest-owned browser splits when
active-tab mirrors point to a terminal, along with the helper function and
unused fixture properties that only that test required.
2026-08-29 15:43:36 -07:00

26 lines
757 B
TypeScript

import type { CloseActiveTabPayload } from './api/ui-command-event-api'
export type AdmittedCloseActiveTabPayload =
| { kind: 'legacy' }
| { kind: 'source'; payload: CloseActiveTabPayload }
| { kind: 'invalid' }
export function admitCloseActiveTabPayload(value: unknown): AdmittedCloseActiveTabPayload {
if (value === undefined) {
return { kind: 'legacy' }
}
if (
typeof value === 'object' &&
value !== null &&
!Array.isArray(value) &&
typeof (value as Record<string, unknown>).sourceId === 'string' &&
(value as Record<string, unknown>).sourceId !== ''
) {
return {
kind: 'source',
payload: { sourceId: (value as Record<string, unknown>).sourceId as string }
}
}
return { kind: 'invalid' }
}