Skip to content

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

chore: update auto complete context in SQL editor (#4002)

boojackbaa0dbfc4dd6
diff --git a/frontend/src/views/sql-editor/EditorPanel/SQLEditor.vue b/frontend/src/views/sql-editor/EditorPanel/SQLEditor.vue
index d229a3b6cf..79152a99a7 100644
--- a/frontend/src/views/sql-editor/EditorPanel/SQLEditor.vue
+++ b/frontend/src/views/sql-editor/EditorPanel/SQLEditor.vue
@@ -158,17 +158,18 @@ const handleEditorReady = async () => {
},
});
- watchEffect(async () => {
+ watchEffect(() => {
if (selectedInstance.value) {
const databaseMap: Map<Database, TableMetadata[]> = new Map();
const databaseList = databaseStore.getDatabaseListByInstanceId(
selectedInstance.value.id
);
+ // Only provide auto-complete context for those opened database.
for (const database of databaseList) {
- const tableList = await dbSchemaStore.getOrFetchTableListByDatabaseId(
- database.id
- );
- databaseMap.set(database, tableList);
+ const tableList = dbSchemaStore.getTableListByDatabaseId(database.id);
+ if (tableList.length > 0) {
+ databaseMap.set(database, tableList);
+ }
}
editorRef.value?.setEditorAutoCompletionContext(databaseMap);
}