docs(terminal): record why the leaf walk counts an empty binding

The ownership walk refuses one; the two rules look like an oversight
without the reason they differ.
This commit is contained in:
Jinwoo-H
2026-09-21 00:23:23 -04:00
parent b1b0f12ba7
commit d9a3fa0cb0
@@ -23,6 +23,8 @@ export function findTerminalTabIdBindingLeafId(
let unboundCarrierTabId: string | null = null
for (const [tabId, layout] of Object.entries(state.terminalLayoutsByTabId)) {
const carriesLeaf = layout.root ? collectLeafIdsInOrder(layout.root).includes(leafId) : null
// Why `!== undefined` and not truthiness, unlike the ownership walk: an empty binding still
// proves this tab holds the leaf id, and holding it is what forbids re-minting it elsewhere.
if (layout.ptyIdsByLeafId?.[leafId] !== undefined && carriesLeaf !== false) {
return tabId
}