fix(desktop): restore table tabs on startup

This commit is contained in:
t8y2 committed 2026-06-01 23:07:47 +08:00
1 parent 2f1a6875b7
commit ad33db0886
5 files changed
+129 -17

No files matched your search

+8 -8
View File
@@ -847,17 +847,17 @@ function initApp() {
}
async function reconnectRestoredTabs() {
if (isDesktop) return;
const connectionIds = new Set(queryStore.tabs.map((t) => t.connectionId).filter(Boolean));
for (const id of connectionIds) {
const activeConnectionId = activeTab.value?.connectionId || connectionStore.activeConnectionId;
if (activeConnectionId && connectionStore.getConfig(activeConnectionId)) {
connectionStore.activeConnectionId = activeConnectionId;
try {
await connectionStore.ensureConnected(id);
await connectionStore.ensureConnected(activeConnectionId);
} catch {}
}
for (const tab of queryStore.tabs) {
if (tab.mode === "data" && tab.tableMeta && tab.sql) {
queryStore.executeTabSql(tab.id, tab.sql).catch(() => {});
}
const tab = activeTab.value;
if (tab?.mode === "data" && tab.tableMeta && tab.sql) {
queryStore.executeTabSql(tab.id, tab.sql).catch(() => {});
}
}