fix(grid): improve scrolling and sidebar responsiveness
This commit is contained in:
8 files changed
+142
-41
No files matched your search
@@ -218,6 +218,10 @@ export const useConnectionStore = defineStore("connection", () => {
|
||||
const activeConnectionId = ref<string | null>(localStorage.getItem(ACTIVE_CONNECTION_STORAGE_KEY));
|
||||
const selectedTreeNodeId = ref<string | null>(null);
|
||||
const selectedTreeNodeIds = ref<string[]>([]);
|
||||
// O(1) membership set — rebuilds only when selectedTreeNodeIds changes.
|
||||
// Avoids O(N) Array.includes() in every visible TreeItem's isMultiSelected
|
||||
// computed during scrolling and selection changes.
|
||||
const selectedTreeNodeIdsSet = computed(() => new Set(selectedTreeNodeIds.value));
|
||||
const treeSelectionAnchorId = ref<string | null>(null);
|
||||
const connectionMultiSelectActive = ref(false);
|
||||
const treeClipboard = ref<TreeClipboard | null>(null);
|
||||
@@ -5062,6 +5066,7 @@ export const useConnectionStore = defineStore("connection", () => {
|
||||
activeConnectionId,
|
||||
selectedTreeNodeId,
|
||||
selectedTreeNodeIds,
|
||||
selectedTreeNodeIdsSet,
|
||||
treeSelectionAnchorId,
|
||||
connectionMultiSelectActive,
|
||||
treeClipboard,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user