fix(sql-library): hydrate restored tabs after startup

This commit is contained in:
t8y2 committed 2026-09-27 14:57:36 +08:00
1 parent e797954334
commit 71027f1412
3 files changed
+48 -2

No files matched your search

+10 -2
View File
@@ -3895,13 +3895,14 @@ function onLoginSuccess() {
async function initApp() {
const t0 = performance.now();
console.log("[STARTUP] initApp begin");
void Promise.all([initSavedSqlEditorPositions(), savedSqlStore.initFromStorage()])
const savedSqlInitialization = Promise.all([initSavedSqlEditorPositions(), savedSqlStore.initFromStorage()])
.then(() => {
console.log(`[STARTUP] savedSqlStore.initFromStorage: ${(performance.now() - t0).toFixed(0)}ms`);
void queryStore.hydrateSavedSqlTabs();
return true;
})
.catch((e: any) => {
toast(t("connection.loadFailed", { message: e?.message || String(e) }), 5000);
return false;
});
const restoreOpenTabs = async () => {
@@ -3931,6 +3932,13 @@ async function initApp() {
onOptionalStateError: (error) => console.error("[STARTUP] settingsStore.initAiConfigs failed", error),
});
}
void savedSqlInitialization
.then((initialized) => {
if (initialized) return queryStore.hydrateSavedSqlTabs();
})
.catch((e: any) => {
toast(t("connection.loadFailed", { message: e?.message || String(e) }), 5000);
});
await runPendingComponentUpdatesBeforePluginReconnect({
hasPendingComponentUpdates: () => !isDetachedWindowContext && hasPendingComponentUpdatesAfterAppRestart(),
prepareStartup: async () => {