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

Function removeTabEverywhere

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

Source from the content-addressed store, hash-verified

230}
231
232export function removeTabEverywhere(
233 state: RightSidebarLayoutState,
234 tab: TabType
235): RightSidebarLayoutState {
236 const nextRoot = removeTabFromNode(state.root, tab);
237 if (!nextRoot) {
238 return getDefaultRightSidebarLayoutState("costs");
239 }
240
241 const focusedExists = findTabset(nextRoot, state.focusedTabsetId) !== null;
242 const focusedTabsetId = focusedExists
243 ? state.focusedTabsetId
244 : (findFirstTabsetId(nextRoot) ?? "tabset-1");
245
246 return {
247 ...state,
248 root: nextRoot,
249 focusedTabsetId,
250 };
251}
252function updateNode(
253 node: RightSidebarLayoutNode,
254 tabsetId: string,

Callers 3

RightSidebarComponentFunction · 0.90
WorkspaceProviderFunction · 0.90
toggleTabFunction · 0.85

Calls 4

removeTabFromNodeFunction · 0.85
findFirstTabsetIdFunction · 0.85
findTabsetFunction · 0.70

Tested by

no test coverage detected