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(connection): sync connection state when expanding cached tree
t8y24cd9432fcbd9
diff --git a/src/stores/connectionStore.ts b/src/stores/connectionStore.tsindex e4598b3a29..f02837ea80 100644--- a/src/stores/connectionStore.ts+++ b/src/stores/connectionStore.ts@@ -490,13 +490,13 @@ export const useConnectionStore = defineStore("connection", () => {async function loadDatabases(connectionId: string, options?: LoadTreeOptions) {const node = findNode(treeNodes.value, connectionId);if (!node) return;- if (useCachedChildren(node, options)) return;- const cacheKey = schemaCacheKey(connectionId, "databases");- if (!options?.force && (await loadPersistedTreeChildren(node, cacheKey))) return;-node.isLoading = true;try {await ensureConnected(connectionId);+ if (useCachedChildren(node, options)) return;+ const cacheKey = schemaCacheKey(connectionId, "databases");+ if (!options?.force && (await loadPersistedTreeChildren(node, cacheKey))) return;+const databases = await api.listDatabases(connectionId);const children = withSavedSqlRoot(connectionId, buildDatabaseTreeNodes(connectionId, databases), node);setChildren(node, children);@@ -596,13 +596,13 @@ export const useConnectionStore = defineStore("connection", () => {const nodeId = `${connectionId}:${database}`;const node = findNode(treeNodes.value, nodeId);if (!node) return;- if (useCachedChildren(node, options)) return;- const cacheKey = schemaCacheKey(connectionId, database, "schemas");- if (!options?.force && (await loadPersistedTreeChildren(node, cacheKey))) return;-node.isLoading = true;try {await ensureConnected(connectionId);+ if (useCachedChildren(node, options)) return;+ const cacheKey = schemaCacheKey(connectionId, database, "schemas");+ if (!options?.force && (await loadPersistedTreeChildren(node, cacheKey))) return;+const schemas = await api.listSchemas(connectionId, database);const children = schemas.map((s) => ({id: `${connectionId}:${database}:${s}`,@@ -626,13 +626,13 @@ export const useConnectionStore = defineStore("connection", () => {const nodeId = `${connectionId}:${database}`;const node = findNode(treeNodes.value, nodeId);if (!node) return;- if (useCachedChildren(node, options)) return;- const cacheKey = schemaCacheKey(connectionId, database, "sqlserver-objects");- if (!options?.force && (await loadPersistedTreeChildren(node, cacheKey))) return;-node.isLoading = true;try {await ensureConnected(connectionId);+ if (useCachedChildren(node, options)) return;+ const cacheKey = schemaCacheKey(connectionId, database, "sqlserver-objects");+ if (!options?.force && (await loadPersistedTreeChildren(node, cacheKey))) return;+const [schemas, defaultSchemaTables] = await Promise.all([api.listSchemas(connectionId, database),api.listTables(connectionId, database, SQLSERVER_DEFAULT_SCHEMA),@@ -650,13 +650,13 @@ export const useConnectionStore = defineStore("connection", () => {const nodeId = schema ? `${connectionId}:${database}:${schema}` : `${connectionId}:${database}`;const node = findNode(treeNodes.value, nodeId);if (!node) return;- if (useCachedChildren(node, options)) return;- const cacheKey = schemaCacheKey(connectionId, database, schema || "", "tables");- if (!options?.force && (await loadPersistedTreeChildren(node, cacheKey))) return;-node.isLoading = true;try {await ensureConnected(connectionId);+ if (useCachedChildren(node, options)) return;+ const cacheKey = schemaCacheKey(connectionId, database, schema || "", "tables");+ if (!options?.force && (await loadPersistedTreeChildren(node, cacheKey))) return;+const querySchema = schema || database;const tables = await api.listTables(connectionId, database, querySchema);const config = getConfig(connectionId);