MCPcopy Index your code
hub / github.com/bytebase/bytebase / locateDatabaseQueryContext

Function locateDatabaseQueryContext

frontend/src/react/stores/sqlEditor/tab.ts:474–486  ·  view source on GitHub ↗
(
  tabsById: Map<string, SQLEditorTab>,
  database: string,
  contextId: string
)

Source from the content-addressed store, hash-verified

472// is currently active — this is what lets an async query that completes
473// after the user switched tabs still resolve to its own tab.
474const locateDatabaseQueryContext = (
475 tabsById: Map<string, SQLEditorTab>,
476 database: string,
477 contextId: string
478): { tabId: string; index: number } | undefined => {
479 for (const [tabId, tab] of tabsById) {
480 const arr = tab.databaseQueryContexts?.get(database);
481 if (!arr) continue;
482 const index = arr.findIndex((c) => c.id === contextId);
483 if (index >= 0) return { tabId, index };
484 }
485 return undefined;
486};
487
488const upsertOpenTabDraft = (
489 state: { openTmpTabList: PersistentTab[]; currentTabId: string },

Callers 2

getDatabaseQueryContextFunction · 0.85

Calls 2

getMethod · 0.45
findIndexMethod · 0.45

Tested by

no test coverage detected