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

Function initProject

frontend/src/react/stores/sqlEditor/tab.ts:371–390  ·  view source on GitHub ↗
(project)

Source from the content-addressed store, hash-verified

369 },
370
371 async initProject(project) {
372 // Dedupe concurrent inits for the same project. During bootstrap
373 // the editor-state subscriber fires a fire-and-forget initProject
374 // while SQLEditorRouteShell separately awaits initProject and then
375 // opens the URL route tab. Sharing one in-flight hydration prevents
376 // the unawaited copy from resolving afterwards and replacing
377 // `tabsById` — which would drop the just-opened route tab.
378 if (_initProjectInFlight?.project === project) {
379 return _initProjectInFlight.promise;
380 }
381 const promise = hydrateProjectTabs(project);
382 _initProjectInFlight = { project, promise };
383 try {
384 await promise;
385 } finally {
386 if (_initProjectInFlight?.project === project) {
387 _initProjectInFlight = undefined;
388 }
389 }
390 },
391
392 reset() {
393 set((s) => {

Callers

nothing calls this directly

Calls 1

hydrateProjectTabsFunction · 0.85

Tested by

no test coverage detected