({ database, contextId, context })
| 344 | }, |
| 345 | |
| 346 | updateDatabaseQueryContext({ database, contextId, context }) { |
| 347 | // Resolve the tab that OWNS this context by its globally-unique id |
| 348 | // rather than assuming `currentTabId`. A query that completes after |
| 349 | // the user switches tabs must still update its own tab's context — |
| 350 | // the Vue original mutated the reactive context object directly, |
| 351 | // which had the same cross-tab effect; immer freezes store objects |
| 352 | // so React must route through this action, hence the lookup. |
| 353 | const owner = locateDatabaseQueryContext( |
| 354 | get().tabsById, |
| 355 | database, |
| 356 | contextId |
| 357 | ); |
| 358 | if (!owner) return undefined; |
| 359 | set((s) => { |
| 360 | const target = s.tabsById |
| 361 | .get(owner.tabId) |
| 362 | ?.databaseQueryContexts?.get(database)?.[owner.index]; |
| 363 | if (!target) return; |
| 364 | Object.assign(target, context); |
| 365 | }); |
| 366 | return get() |
| 367 | .tabsById.get(owner.tabId) |
| 368 | ?.databaseQueryContexts?.get(database)?.[owner.index]; |
| 369 | }, |
| 370 | |
| 371 | async initProject(project) { |
| 372 | // Dedupe concurrent inits for the same project. During bootstrap |
nothing calls this directly
no test coverage detected