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): keep batch column session across empty results
zipgc224b3c972b1
diff --git a/apps/desktop/src/components/editor/__tests__/useQueryEditorBatchSelection.spec.ts b/apps/desktop/src/components/editor/__tests__/useQueryEditorBatchSelection.spec.tsindex 70d64f5af6..ec84a8cdd0 100644--- a/apps/desktop/src/components/editor/__tests__/useQueryEditorBatchSelection.spec.ts+++ b/apps/desktop/src/components/editor/__tests__/useQueryEditorBatchSelection.spec.ts@@ -91,8 +91,23 @@ describe("QueryEditor batch selection ownership", () => {batch.toggleAllBatchColumnSelection(currentView, session.key);expect(next.selectedKeys.size).toBe(0);expect(next.completionOptions.size).toBe(0);- batch.prepareBatchColumnSelectionSession([], next.document, next.from, next.to);- expect(batch.expandedRendering).toBe(false);+ });++ it("keeps the checked fields when a sibling result carries no column candidates (dbx#9973)", () => {+ const { batch, session, items, currentView, row } = createHarness();+ batch.toggleAllBatchColumnSelection(currentView, session.key);+ // One completion request builds several result sets and only some of them+ // carry column candidates. The empty one must not drop the session that the+ // rendered checkbox rows still point at.+ expect(batch.prepareBatchColumnSelectionSession([], session.document, session.from, session.to)).toBeNull();+ expect(batch.expandedRendering).toBe(true);+ expect(batch.prepareBatchColumnSelectionSession(items, session.document, session.from, session.to)).toBe(session);+ expect(session.selectedKeys).toEqual(new Set(session.candidates.map((candidate) => candidate.key)));+ const { checkbox } = row(0);+ expect(checkbox.checked).toBe(true);+ checkbox.dispatchEvent(new PointerEvent("pointerdown", { button: 0, buttons: 1, isPrimary: true, pointerId: 5, bubbles: true }));+ expect(session.selectedKeys.has(session.candidates[0].key)).toBe(false);+ document.body.style.userSelect = "";});it("guards label clicks and applies checked fields together, never an individual row", () => {diff --git a/apps/desktop/src/components/editor/useQueryEditorBatchSelection.ts b/apps/desktop/src/components/editor/useQueryEditorBatchSelection.tsindex 84497255a0..d515694248 100644--- a/apps/desktop/src/components/editor/useQueryEditorBatchSelection.ts+++ b/apps/desktop/src/components/editor/useQueryEditorBatchSelection.ts@@ -254,7 +254,17 @@ export function useQueryEditorBatchSelection(options: QueryEditorBatchSelectionOfunction prepareBatchColumnSelectionSession(items: SqlCompletionItem[], document: string, from: number, to: number): BatchColumnSelectionSession | null {const selectableItems = items.filter((item) => item.type === "column" && item.batchSelectionMode && item.apply);if (selectableItems.length === 0) {- clearBatchColumnSelectionSession();+ // One completion request builds several result sets (the local pass plus+ // the metadata pass) and only some of them carry column candidates.+ // Clearing the stored session for such an empty sibling result left the+ // checkbox rows rendered by the other result attached to a session that+ // no longer existed, so clicking a checkbox did nothing. It also made the+ // expanded-rendering flag flap false→true on every pass, reconfiguring+ // CodeMirror's autocompletion compartment while a source was still+ // pending; the recreated list stayed disabled (ArrowUp/Down ignored, then+ // closed on the next caret move). Keep the session and only report "no+ // batch selection" for this result (dbx#9973). The session is still+ // dropped when the popup closes, on Escape and after an accepted row.return null;}