MCPcopy Create free account
hub / github.com/MCSManager/MCSManager / handleRemoveTab

Function handleRemoveTab

frontend/src/hooks/useFileManager.ts:132–149  ·  view source on GitHub ↗
(key: string)

Source from the content-addressed store, hash-verified

130 });
131
132 const handleRemoveTab = (key: string) => {
133 const index = currentTabs.value.findIndex((tab) => tab.key === key);
134 if (index !== -1) {
135 currentTabs.value.splice(index, 1);
136 if (!currentTabs.value.length) {
137 initDefaultTab();
138 return;
139 }
140
141 if (activeTab.value === key) {
142 // Prefer to switch to the previous tab; if none exists, take the last one
143 const prevIndex = index > 0 ? index - 1 : currentTabs.value.length - 1;
144 const nextKey = currentTabs.value[prevIndex]?.key || "";
145 activeTab.value = nextKey;
146 handleChangeTab(nextKey);
147 }
148 }
149 };
150
151 const onEditTabs = (targetKey: MouseEvent | Key | KeyboardEvent, action: "remove" | "add") => {
152 if (action === "add") {

Callers 1

onEditTabsFunction · 0.85

Calls 2

initDefaultTabFunction · 0.85
handleChangeTabFunction · 0.85

Tested by

no test coverage detected