mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-30 00:19:35 +00:00
perf(sidebar): fix UI lag with 100+ databases (closes #201)
- Lower virtual scrolling threshold from 400 to 100 nodes so RecycleScroller activates earlier with many databases - Memoize getConfig() with a computed Map to avoid O(n) linear search on every TreeItem computed property evaluation
This commit is contained in:
@@ -23,5 +23,5 @@ export function flattenTree(nodes: TreeNode[]): FlatTreeNode[] {
|
||||
}
|
||||
|
||||
export function shouldVirtualizeFlatTree(count: number): boolean {
|
||||
return count >= 400;
|
||||
return count >= 100;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { uuid } from "@/lib/utils";
|
||||
import { ref, watch } from "vue";
|
||||
import { ref, computed, watch } from "vue";
|
||||
import type { ColumnInfo, ConnectionConfig, SidebarLayout, TreeNode } from "@/types/database";
|
||||
import { orderPinnedFirst } from "@/lib/pinnedItems";
|
||||
import {
|
||||
@@ -111,8 +111,10 @@ export const useConnectionStore = defineStore("connection", () => {
|
||||
newConnectionGroupId.value = null;
|
||||
}
|
||||
|
||||
const configById = computed(() => new Map(connections.value.map((c) => [c.id, c])));
|
||||
|
||||
function getConfig(connectionId: string) {
|
||||
return connections.value.find((c) => c.id === connectionId);
|
||||
return configById.value.get(connectionId);
|
||||
}
|
||||
|
||||
function connectionErrorMessage(error: unknown): string {
|
||||
|
||||
Reference in New Issue
Block a user