25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(sidebar): preserve connection node during metadata refresh
t8y27b356ddb22fb
diff --git a/apps/desktop/src/stores/__tests__/connectionStore.databaseInfo.spec.ts b/apps/desktop/src/stores/__tests__/connectionStore.databaseInfo.spec.tsindex 1c7bf873ed..f8b7f2d632 100644--- a/apps/desktop/src/stores/__tests__/connectionStore.databaseInfo.spec.ts+++ b/apps/desktop/src/stores/__tests__/connectionStore.databaseInfo.spec.ts@@ -74,6 +74,33 @@ describe("connectionStore database info", () => {expect(store.connectedIds.has(config.id)).toBe(true);});+ it("preserves the connection tree node while background database info is stored", async () => {+ const config = mysqlConnection();+ const saveConnectionDatabaseInfo = vi.fn().mockResolvedValue(undefined);++ vi.doMock("@/lib/backend/tauriRuntime", () => ({ isTauriRuntime: () => false }));+ vi.doMock("@/lib/backend/api", () => ({+ connectDb: vi.fn().mockResolvedValue(config.id),+ connectionDatabaseInfo: vi.fn().mockResolvedValue({ productName: "MySQL", productVersion: "8.0.34" }),+ saveConnectionDatabaseInfo,+ saveConnections: vi.fn().mockResolvedValue(undefined),+ saveSidebarLayout: vi.fn().mockResolvedValue(undefined),+ connectionIdentifierQuote: vi.fn().mockResolvedValue(undefined),+ }));++ const { useConnectionStore } = await import("@/stores/connectionStore");+ const store = useConnectionStore();+ await store.addConnection(config);+ const connectionNode = store.treeNodes[0];++ await store.connect(config);+ await vi.waitFor(() => expect(saveConnectionDatabaseInfo).toHaveBeenCalled());++ expect(store.treeNodes[0]).toBe(connectionNode);+ expect(store.getConfig(config.id)?.database_info?.productVersion).toBe("8.0.34");+ expect(store.connectedIds.has(config.id)).toBe(true);+ });+it("does not delay connection success while optional metadata is loading", async () => {const config = mysqlConnection();let resolveDatabaseInfo!: (value: { productName: string; productVersion: string }) => void;diff --git a/apps/desktop/src/stores/connectionStore.ts b/apps/desktop/src/stores/connectionStore.tsindex 5b18188237..d547e22799 100644--- a/apps/desktop/src/stores/connectionStore.ts+++ b/apps/desktop/src/stores/connectionStore.ts@@ -1811,7 +1811,9 @@ export const useConnectionStore = defineStore("connection", () => {const nextConnections = [...connections.value];nextConnections[index] = { ...nextConnections[index], database_info: normalized };connections.value = nextConnections;- rebuildTreeNodes();+ // Database info is reactive connection metadata, not tree structure. Keep+ // navigator node identities stable so an in-flight first expansion can+ // still apply its loaded children after this background refresh completes.}async function refreshConnectedDatabaseInfo(connectionId: string, config: ConnectionConfig): Promise<void> {