MCPcopy Create free account
hub / github.com/bytebase/bytebase / removeDatabaseQueryContext

Function removeDatabaseQueryContext

frontend/src/react/stores/sqlEditor/tab.ts:301–317  ·  view source on GitHub ↗
({ database, contextId })

Source from the content-addressed store, hash-verified

299 },
300
301 removeDatabaseQueryContext({ database, contextId }) {
302 const id = get().currentTabId;
303 const tab = get().tabsById.get(id);
304 if (!tab?.databaseQueryContexts?.has(database)) return undefined;
305 const contexts = tab.databaseQueryContexts.get(database)!;
306 const index = contexts.findIndex((c) => c.id === contextId);
307 if (index < 0) return undefined;
308 let next: SQLEditorDatabaseQueryContext | undefined;
309 set((s) => {
310 const draftTab = s.tabsById.get(id);
311 if (!draftTab?.databaseQueryContexts?.has(database)) return;
312 const arr = draftTab.databaseQueryContexts.get(database)!;
313 arr.splice(index, 1);
314 next = arr[index] ?? arr[index - 1];
315 });
316 return next;
317 },
318
319 batchRemoveDatabaseQueryContext({ database, contextIds }) {
320 if (contextIds.length === 0) return;

Callers

nothing calls this directly

Calls 4

getFunction · 0.85
setFunction · 0.85
getMethod · 0.45
findIndexMethod · 0.45

Tested by

no test coverage detected