fix(grid): improve scrolling and sidebar responsiveness

This commit is contained in:
juve authored and GitHub committed 2026-07-13 16:12:54 +08:00
1 parent 67541232a2
commit 29b351691a
8 files changed
+142 -41

No files matched your search

+17 -1
View File
@@ -326,6 +326,21 @@ export const useQueryStore = defineStore("query", () => {
const t = getI18nT();
const settingsStore = useSettingsStore();
const tabs = ref<QueryTab[]>([]);
// A stable Set of "connectionId\x00database" keys. Computed only from the
// minimal tab identity fields so that it does NOT invalidate when other
// properties change (isExecuting, result, sql, tableMeta...). Previously
// isDatabaseOpen() called tabs.value.some() which tracked the full reactive
// array — every mutation during openData() forced all database-type sidebar
// TreeItems to recompute showsDatabaseOpenIndicator.
const openDatabaseKeys = computed(() => {
const keys = new Set<string>();
for (const tab of tabs.value) {
if (tab.connectionId && tab.database != null) {
keys.add(`${tab.connectionId}\x00${tab.database}`);
}
}
return keys;
});
const activeTabId = ref<string | null>(null);
const isOpenTabsLoaded = ref(false);
const activeTabHistory = ref<string[]>([]);
@@ -1665,7 +1680,7 @@ export const useQueryStore = defineStore("query", () => {
}
function isDatabaseOpen(connectionId: string, database: string) {
return tabs.value.some((tab) => tab.connectionId === connectionId && tab.database === database);
return openDatabaseKeys.value.has(`${connectionId}\x00${database}`);
}
function rollbackTabsWhere(predicate: (tab: QueryTab) => boolean, options?: { resetAutoCommit?: boolean }) {
@@ -3776,6 +3791,7 @@ export const useQueryStore = defineStore("query", () => {
releaseConnectionTabs,
releaseDatabaseTabs,
isDatabaseOpen,
openDatabaseKeys,
rollbackConnectionTransactions,
rollbackDatabaseTransactions,
updateSql,