MCPcopy Index your code
hub / github.com/coder/mux / selectTabInTabset

Function selectTabInTabset

src/browser/utils/rightSidebarLayout.ts:279–300  ·  view source on GitHub ↗
(
  state: RightSidebarLayoutState,
  tabsetId: string,
  tab: TabType
)

Source from the content-addressed store, hash-verified

277}
278
279export function selectTabInTabset(
280 state: RightSidebarLayoutState,
281 tabsetId: string,
282 tab: TabType
283): RightSidebarLayoutState {
284 const target = findTabset(state.root, tabsetId);
285 if (target?.type !== "tabset") {
286 return state;
287 }
288
289 if (target.activeTab === tab && target.tabs.includes(tab)) {
290 return state;
291 }
292
293 return {
294 ...state,
295 root: updateNode(state.root, tabsetId, (ts) => {
296 const tabs = ts.tabs.includes(tab) ? ts.tabs : [...ts.tabs, tab];
297 return { ...ts, tabs, activeTab: tab };
298 }),
299 };
300}
301
302export function reorderTabInTabset(
303 state: RightSidebarLayoutState,

Callers 5

buildCoreSourcesFunction · 0.90
selectTabFunction · 0.90
selectTabByIndexFunction · 0.85
selectOrAddTabFunction · 0.85
moveTabToTabsetFunction · 0.85

Calls 2

updateNodeFunction · 0.85
findTabsetFunction · 0.70

Tested by

no test coverage detected