MCPcopy
hub / github.com/coder/mux / selectOrAddTab

Function selectOrAddTab

src/browser/utils/rightSidebarLayout.ts:563–573  ·  view source on GitHub ↗
(
  state: RightSidebarLayoutState,
  tab: TabType
)

Source from the content-addressed store, hash-verified

561 * Select an existing tab anywhere in the layout, or add it to the focused tabset if missing.
562 */
563export function selectOrAddTab(
564 state: RightSidebarLayoutState,
565 tab: TabType
566): RightSidebarLayoutState {
567 const found = collectAllTabsWithTabset(state.root).find((t) => t.tab === tab);
568 if (found) {
569 return selectTabInTabset(setFocusedTabset(state, found.tabsetId), found.tabsetId, found.tab);
570 }
571
572 return addTabToFocusedTabset(state, tab);
573}
574
575/**
576 * Move a tab from one tabset to another.

Callers 4

focusRightSidebarTabFunction · 0.90
RightSidebarComponentFunction · 0.90
handleOpenGoalTabFunction · 0.90
toggleTabFunction · 0.85

Calls 4

collectAllTabsWithTabsetFunction · 0.85
selectTabInTabsetFunction · 0.85
setFocusedTabsetFunction · 0.85
addTabToFocusedTabsetFunction · 0.85

Tested by

no test coverage detected