Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: don't fetch db schema eagerly when connecting to instance scope (#6880)

Liu Jid85c0740bab1
diff --git a/frontend/src/store/modules/connectionTree.ts b/frontend/src/store/modules/connectionTree.ts
index d57b36f968..4514b9eaca 100644
--- a/frontend/src/store/modules/connectionTree.ts
+++ b/frontend/src/store/modules/connectionTree.ts
@@ -78,13 +78,6 @@ export const useConnectionTreeStore = defineStore("connectionTree", () => {
): Promise<Connection> => {
try {
await useInstanceV1Store().getOrFetchInstanceByUID(instanceId);
- const databaseList = useDatabaseV1Store().databaseList.filter(
- (db) => db.instanceEntity.uid === instanceId
- );
- const dbSchemaStore = useDBSchemaV1Store();
- await Promise.all(
- databaseList.map((db) => dbSchemaStore.getOrFetchTableList(db.name))
- );
return {
instanceId,
diff --git a/frontend/src/views/sql-editor/TerminalPanel/CompactSQLEditor.vue b/frontend/src/views/sql-editor/TerminalPanel/CompactSQLEditor.vue
index fa139b501c..5519c00d67 100644
--- a/frontend/src/views/sql-editor/TerminalPanel/CompactSQLEditor.vue
+++ b/frontend/src/views/sql-editor/TerminalPanel/CompactSQLEditor.vue
@@ -299,11 +299,12 @@ const handleEditorReady = async () => {
const databaseList = selectedDatabase.value
? [selectedDatabase.value]
: databaseStore.databaseListByInstance(selectedInstance.value.name);
+ // Only provide auto-complete context for those opened database.
for (const database of databaseList) {
- const tableList = await dbSchemaStore.getOrFetchTableList(
- database.name
- );
- databaseMap.set(database, tableList);
+ const tableList = dbSchemaStore.getTableList(database.name);
+ if (tableList.length > 0) {
+ databaseMap.set(database, tableList);
+ }
}
const connectionScope = selectedDatabase.value ? "database" : "instance";
editorRef.value?.setEditorAutoCompletionContextV1(