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。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(editor): prefetch completion tables instead of recursing on mount (#13534)
zipg66dafbdc66b1
diff --git a/apps/desktop/src/components/editor/QueryEditor.vue b/apps/desktop/src/components/editor/QueryEditor.vueindex 7e37dd9280..4b1c265995 100644--- a/apps/desktop/src/components/editor/QueryEditor.vue+++ b/apps/desktop/src/components/editor/QueryEditor.vue@@ -2718,7 +2718,7 @@ watch();function prefetchCompletionTablesIfEnabled() {- if (props.prefetchCompletion) prefetchCompletionTablesIfEnabled();+ if (props.prefetchCompletion) void completionMetadata.prefetchCompletionTables();}watch(diff --git a/apps/desktop/src/components/editor/__tests__/QueryEditor.componentSplit.integration.spec.ts b/apps/desktop/src/components/editor/__tests__/QueryEditor.componentSplit.integration.spec.tsindex dc5d3cbc8e..a765d0bd10 100644--- a/apps/desktop/src/components/editor/__tests__/QueryEditor.componentSplit.integration.spec.ts+++ b/apps/desktop/src/components/editor/__tests__/QueryEditor.componentSplit.integration.spec.ts@@ -29,7 +29,7 @@ afterEach(() => {vi.restoreAllMocks();});-async function mountEditor(overrides: Partial<QueryEditorProps> = {}, vimEnabled = false) {+async function mountEditor(overrides: Partial<QueryEditorProps> = {}, vimEnabled = false, beforeMount?: (stores: { connectionStore: ReturnType<typeof useConnectionStore> }) => void) {const pinia = createPinia();setActivePinia(pinia);const settingsStore = useSettingsStore();@@ -60,6 +60,9 @@ async function mountEditor(overrides: Partial<QueryEditorProps> = {}, vimEnabled});app.use(pinia);app.use(createI18n({ legacy: false, locale: "en", messages: { en: {} }, missingWarn: false, fallbackWarn: false }));+ // Lets a test stub store methods before the component setup (and any eager+ // setup-time work such as completion prefetch) runs during mount.+ beforeMount?.({ connectionStore });app.mount(host);let mounted = true;const unmount = () => {@@ -462,4 +465,16 @@ describe("QueryEditor component split integration", () => {window.dispatchEvent(createTableReferenceDropEvent({ payload, clientX: 30, clientY: 40 }));expect(position).not.toHaveBeenCalled();});++ it("prefetches completion tables for the active database instead of recursing on mount", async () => {+ // Regression for #13529 / #13531: QueryEditor setup called the prefetch+ // helper unconditionally, so prefetchCompletion: true (set for query tabs)+ // recursed until RangeError killed the editor mount.+ const listCompletionTables = vi.fn().mockResolvedValue([{ name: "users", type: "table" }]);+ await mountEditor({ prefetchCompletion: true, connectionId: "c1", database: "shop" }, false, ({ connectionStore: store }) => {+ vi.spyOn(store, "listCompletionTables").mockImplementation(listCompletionTables);+ });+ await vi.waitFor(() => expect(listCompletionTables).toHaveBeenCalled());+ expect(listCompletionTables).toHaveBeenCalledWith("c1", "shop", "", 500, undefined, false, undefined, undefined, { activateConnection: false });+ });});