(tabId)
| 234 | }, |
| 235 | |
| 236 | closeTab(tabId) { |
| 237 | const position = get().openTmpTabList.findIndex( |
| 238 | (item) => item.id === tabId |
| 239 | ); |
| 240 | if (position < 0) return; |
| 241 | |
| 242 | const wasCurrent = tabId === get().currentTabId; |
| 243 | |
| 244 | set((s) => { |
| 245 | s.openTmpTabList.splice(position, 1); |
| 246 | s.tabsById.delete(tabId); |
| 247 | if (wasCurrent) { |
| 248 | const nextIndex = Math.min(position, s.openTmpTabList.length - 1); |
| 249 | s.currentTabId = s.openTmpTabList[nextIndex]?.id ?? ""; |
| 250 | } |
| 251 | }); |
| 252 | |
| 253 | persistOpenTabs(get().openTmpTabList); |
| 254 | if (wasCurrent) { |
| 255 | persistCurrentTabId(get().currentTabId); |
| 256 | } |
| 257 | |
| 258 | // Dynamic import avoids a static cycle with the web terminal |
| 259 | // service module (which transitively re-imports this module). |
| 260 | void import("@/react/stores/sqlEditor/webTerminal-service").then( |
| 261 | ({ disposeWebTerminalQuerySession }) => { |
| 262 | disposeWebTerminalQuerySession(tabId); |
| 263 | } |
| 264 | ); |
| 265 | }, |
| 266 | |
| 267 | updateTab(id, payload) { |
| 268 | if (!get().tabsById.has(id)) return undefined; |
nothing calls this directly
no test coverage detected