( tabsById: Map<string, SQLEditorTab>, database: string, contextId: string )
| 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. |
| 474 | const 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 | |
| 488 | const upsertOpenTabDraft = ( |
| 489 | state: { openTmpTabList: PersistentTab[]; currentTabId: string }, |
no test coverage detected