fix(completion): prevent PostgreSQL completion failure from breaking all subsequent completions (#131)

This commit is contained in:
t8y2 committed 2026-05-07 11:25:50 +08:00
1 parent edd1e58286
commit 14292dd2f8
2 files changed
+75 -67

No files matched your search

+10 -6
View File
@@ -669,12 +669,16 @@ export const useConnectionStore = defineStore("connection", () => {
const schemas = await api.listSchemas(connectionId, database);
const tableGroups = await Promise.all(
schemas.map(async (schema) => {
const tables = await api.listTables(connectionId, database, schema);
return tables.map((table) => ({
name: table.name,
schema,
type: table.table_type === "VIEW" ? ("view" as const) : ("table" as const),
}));
try {
const tables = await api.listTables(connectionId, database, schema);
return tables.map((table) => ({
name: table.name,
schema,
type: table.table_type === "VIEW" ? ("view" as const) : ("table" as const),
}));
} catch {
return [];
}
}),
);
completionTablesCache.value[cacheKey] = tableGroups.flat();