From 971871132b87a2eb38e5bcfc1adf1e618d848ebb Mon Sep 17 00:00:00 2001 From: zipg Date: Wed, 12 Aug 2026 00:12:02 +0800 Subject: [PATCH] fix(grid): sync cell details on mouse selection --- apps/desktop/src/components/grid/DataGrid.vue | 2 +- .../__tests__/DataGridCellDetailSelection.spec.ts | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 apps/desktop/src/components/grid/__tests__/DataGridCellDetailSelection.spec.ts diff --git a/apps/desktop/src/components/grid/DataGrid.vue b/apps/desktop/src/components/grid/DataGrid.vue index 50c2af3d1c..a464c6deb3 100644 --- a/apps/desktop/src/components/grid/DataGrid.vue +++ b/apps/desktop/src/components/grid/DataGrid.vue @@ -6190,7 +6190,7 @@ function onTransposeCellContext(rowIndex: number, actualColIdx: number, event: M contextCell.value = item ? { rowId: item.id, rowIndex, col: actualColIdx } : null; } -watch([selectedRange, showCellDetail, isEditingDetail], () => { +watch([selectedRange, showCellDetail, isEditingDetail, isSelectingCells], () => { if (isSelectingCells.value) return; const selectedCell = currentSelectedCellPosition(); const target = linkedCellDetailTarget({ diff --git a/apps/desktop/src/components/grid/__tests__/DataGridCellDetailSelection.spec.ts b/apps/desktop/src/components/grid/__tests__/DataGridCellDetailSelection.spec.ts new file mode 100644 index 0000000000..4ba105b1a6 --- /dev/null +++ b/apps/desktop/src/components/grid/__tests__/DataGridCellDetailSelection.spec.ts @@ -0,0 +1,11 @@ +import { readFileSync } from "node:fs"; +import { describe, expect, it } from "vitest"; + +const dataGridSource = readFileSync(new URL("../DataGrid.vue", import.meta.url), "utf8"); + +describe("DataGrid cell detail selection", () => { + it("resynchronizes the open detail after a mouse selection gesture finishes", () => { + expect(dataGridSource).toContain("watch([selectedRange, showCellDetail, isEditingDetail, isSelectingCells]"); + expect(dataGridSource).toContain("if (isSelectingCells.value) return;"); + }); +});