fix(tabs): reuse data tabs only for the same table

This commit is contained in:
zipg authored and GitHub committed 2026-08-03 17:05:56 +08:00
1 parent 6e4363be36
commit 51560c49ae
16 files changed
+115 -23

No files matched your search

+7 -1
View File
@@ -42,7 +42,7 @@ import { dataTabExecutionDatabase } from "@/lib/table/dataTabExecutionDatabase";
import { tableOpenPageLimit } from "@/lib/table/tableOpenPageLimit";
import { getCachedTableMetadata, loadTableIndexes, loadTableMetadata, type TableMetadataRequest } from "@/lib/metadata/tableMetadataCache";
import { buildTableSelectSql, quoteTableDataIdentifier } from "@/lib/table/tableSelectSql";
import { connectionQueryExecutionSchema, connectionUsesDatabaseObjectTreeMode, effectiveDatabaseTypeForConnection, metadataSchemaForConnection } from "@/lib/database/jdbcDialect";
import { connectionObjectTreeNodeSchema, connectionQueryExecutionSchema, connectionUsesDatabaseObjectTreeMode, effectiveDatabaseTypeForConnection, metadataSchemaForConnection } from "@/lib/database/jdbcDialect";
import { frontendQueryTimeoutSecsForSql, queryTimeoutSecsForConnection } from "@/lib/sql/queryTimeout";
import { queryResultNameFromPreamble, queryResultSourceLabel } from "@/lib/sql/queryResultSource";
import { beginDataGridNativeSelectionBlock, finishDataGridNativeSelectionBlock } from "@/lib/dataGrid/dataGridNativeSelection";
@@ -1200,6 +1200,12 @@ export const useQueryStore = defineStore("query", () => {
}
function applyRestoredOpenTabs(restored: { tabs: QueryTab[]; activeTabId: string | null }) {
const connectionStore = useConnectionStore();
for (const tab of restored.tabs) {
if (tab.mode !== "data") continue;
const connection = connectionStore.getConfig(tab.connectionId);
if (connection) tab.schema = connectionObjectTreeNodeSchema(connection, tab.database, tab.schema);
}
tabs.value = restored.tabs;
activeTabId.value = restored.activeTabId;
activeTabHistory.value = restored.activeTabId ? [restored.activeTabId] : [];