(index: number)
| 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">) => { |
no test coverage detected