MCPcopy Index your code
hub / github.com/anomalyco/opencode / removeTab

Function removeTab

packages/app/src/context/tabs.tsx:115–134  ·  view source on GitHub ↗
(index: number)

Source from the content-addressed store, hash-verified

113 }
114
115 const removeTab = (index: number) => {
116 const tab = store[index]
117 if (!tab) return
118 const key = tabKey(tab)
119 const draftID = tab.type === "draft" ? tab.draftID : undefined
120 const nextTab = store[index + 1] ?? store[index - 1]
121 closing.add(key)
122 void startTransition(() => {
123 setStore(
124 produce((tabs) => {
125 tabs.splice(index, 1)
126 }),
127 )
128 if (recent.key === key) setRecentKey(nextTab && tabKey(nextTab))
129 if (nextTab) navigateTab(nextTab)
130 else navigate("/")
131 }).finally(() => closing.delete(key))
132 memory.remove(key)
133 if (draftID) removeDraftPersisted(draftID)
134 }
135
136 const actions = {
137 addSessionTab: (tab: Omit<SessionTab, "type">) => {

Callers 1

removeSessionTabFunction · 0.85

Calls 9

tabKeyFunction · 0.85
setStoreFunction · 0.85
setRecentKeyFunction · 0.85
navigateTabFunction · 0.85
removeDraftPersistedFunction · 0.85
addMethod · 0.65
removeMethod · 0.65
navigateFunction · 0.50
deleteMethod · 0.45

Tested by

no test coverage detected