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

Function appendTabsToTabset

src/browser/utils/rightSidebarLayout.ts:126–140  ·  view source on GitHub ↗

Append tabs to the named tabset, returning a new tree (or the original if unchanged).

(
  node: RightSidebarLayoutNode,
  tabsetId: string,
  tabs: TabType[]
)

Source from the content-addressed store, hash-verified

124
125/** Append tabs to the named tabset, returning a new tree (or the original if unchanged). */
126function appendTabsToTabset(
127 node: RightSidebarLayoutNode,
128 tabsetId: string,
129 tabs: TabType[]
130): RightSidebarLayoutNode {
131 if (node.type === "tabset") {
132 if (node.id !== tabsetId) return node;
133 return { ...node, tabs: [...node.tabs, ...tabs] };
134 }
135
136 const left = appendTabsToTabset(node.children[0], tabsetId, tabs);
137 const right = appendTabsToTabset(node.children[1], tabsetId, tabs);
138 if (left === node.children[0] && right === node.children[1]) return node;
139 return { ...node, children: [left, right] };
140}
141
142/**
143 * Recursively strip removed static tabs from raw layout data.

Callers 1

ensureDefaultLayoutTabsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected