fix(metadata): await object cache invalidation on connection refresh

This commit is contained in:
soddygo authored and GitHub committed 2026-09-15 12:21:18 +08:00
1 parent f95650f039
commit faf259fcc2
17 files changed
+536 -32

No files matched your search

@@ -162,6 +162,7 @@ import { formatSqlForDisplay, sqlFormatDialectForDbType } from "@/lib/sql/sqlFor
import { omitDdlIdentifierQuotes } from "@/lib/sql/ddlDisplay";
import { getTableStructureCapabilities } from "@/lib/table/tableStructureCapabilities";
import { connectionObjectTreeNodeSchema, connectionObjectTreeQuerySchema, connectionTableSqlSchema, connectionUsesDatabaseObjectTreeMode, effectiveDatabaseTypeForConnection, tableStructureDatabaseTypeForConnection } from "@/lib/database/jdbcDialect";
import { isObjectCacheInvalidationError } from "@/lib/metadata/objectCacheInvalidationError";
import { hasTreeNodeDatabaseContext } from "@/lib/sidebar/treeNodeContext";
import {
defaultPasteTableMode,
@@ -2191,6 +2192,19 @@ function openElasticsearchIndexMetadata(kind: ElasticsearchIndexMetadataKind) {
async function refresh() {
const node = activeNode.value;
if (node.type === "connection" && node.connectionId) {
try {
await connectionStore.refreshConnectionTreeNode(node);
} catch (e: any) {
if (isObjectCacheInvalidationError(e)) {
toast(t("connection.objectCacheRefreshFailed", { message: translateBackendError(t, e) }), 5000);
return;
}
toast(t("connection.connectFailed", { message: translateBackendError(t, e) }), 5000);
openDriverStoreForInstallError(e?.message || String(e), node);
}
return;
}
try {
await connectionStore.refreshTreeNode(node);
} catch (e: any) {