Skip to content

armgit / dbx

Public Imported from GitHub
0

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。

fix(editor): limit completion prefetch to query tabs

t8y2af00d5e751c9
diff --git a/apps/desktop/src/components/editor/QueryEditor.vue b/apps/desktop/src/components/editor/QueryEditor.vue
index 0ce5548e54..954289b1b7 100644
--- a/apps/desktop/src/components/editor/QueryEditor.vue
+++ b/apps/desktop/src/components/editor/QueryEditor.vue
@@ -2707,12 +2707,16 @@ watch(
{ deep: true },
);
+function prefetchCompletionTablesIfEnabled() {
+ if (props.prefetchCompletion) prefetchCompletionTablesIfEnabled();
+}
+
watch(
() => props.connectionId,
() => {
completion.invalidateRequests();
refreshCompletionCache();
- void completionMetadata.prefetchCompletionTables();
+ prefetchCompletionTablesIfEnabled();
setSemanticDiagnostics([]);
scheduleSemanticDiagnostics();
},
@@ -2723,7 +2727,7 @@ watch(
() => {
completion.invalidateRequests();
refreshCompletionCache();
- void completionMetadata.prefetchCompletionTables();
+ prefetchCompletionTablesIfEnabled();
setSemanticDiagnostics([]);
scheduleSemanticDiagnostics();
},
@@ -2734,7 +2738,7 @@ watch(
() => {
completion.invalidateRequests();
refreshCompletionCache();
- void completionMetadata.prefetchCompletionTables();
+ prefetchCompletionTablesIfEnabled();
setSemanticDiagnostics([]);
scheduleSemanticDiagnostics();
},
@@ -2745,7 +2749,7 @@ watch(
() => {
completion.invalidateRequests();
refreshCompletionCache();
- void completionMetadata.prefetchCompletionTables();
+ prefetchCompletionTablesIfEnabled();
setSemanticDiagnostics([]);
scheduleSemanticDiagnostics();
},
@@ -2761,7 +2765,7 @@ watch(
},
);
-void completionMetadata.prefetchCompletionTables();
+prefetchCompletionTablesIfEnabled();
watch([() => props.clientSessionId, () => props.completionContextVersion], () => {
completion.invalidateRequests();
diff --git a/apps/desktop/src/components/editor/queryEditorTypes.ts b/apps/desktop/src/components/editor/queryEditorTypes.ts
index 2562b2336e..605b8229dc 100644
--- a/apps/desktop/src/components/editor/queryEditorTypes.ts
+++ b/apps/desktop/src/components/editor/queryEditorTypes.ts
@@ -12,6 +12,8 @@ export interface QueryEditorProps {
connectionId?: string;
catalog?: string;
database?: string;
+ /** Warm table metadata for the active database; only query tabs enable this. */
+ prefetchCompletion?: boolean;
schema?: string;
clientSessionId?: string;
completionContextVersion?: number;
diff --git a/apps/desktop/src/components/layout/ContentArea.vue b/apps/desktop/src/components/layout/ContentArea.vue
index a5b1d1e9f9..1642225ae9 100644
--- a/apps/desktop/src/components/layout/ContentArea.vue
+++ b/apps/desktop/src/components/layout/ContentArea.vue
@@ -2291,6 +2291,7 @@ defineExpose({
:model-value="activeTab.sql"
:tab-id="activeTab.id"
:connection-id="activeTab.connectionId"
+ :prefetch-completion="true"
:catalog="activeTab.catalog"
:database="activeTab.database"
:schema="activeTab.schema"