From fd46869c1447dc59f7410eed20466d7ac76356a0 Mon Sep 17 00:00:00 2001 From: Caisin Date: Mon, 29 Jun 2026 11:16:38 +0800 Subject: [PATCH] Keep first inserted grid row visible while editing --- apps/desktop/src/components/grid/DataGrid.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/desktop/src/components/grid/DataGrid.vue b/apps/desktop/src/components/grid/DataGrid.vue index 1485474cc7..5d5af30ef9 100644 --- a/apps/desktop/src/components/grid/DataGrid.vue +++ b/apps/desktop/src/components/grid/DataGrid.vue @@ -4883,7 +4883,16 @@ function drawCanvasGrid() { }); } -watch(useCanvasGridRows, () => nextTick(attachCanvasResizeObserver), { immediate: true }); +watch( + [useCanvasGridRows, hasVisibleRows], + () => { + // When an empty table gets its first pending row, the canvas scroller is created by + // the v-if branch after the original mount-time observer attempt has already no-op'd. + // Reattach after that branch mounts so the canvas/overlay get real viewport dimensions. + nextTick(attachCanvasResizeObserver); + }, + { immediate: true }, +); watch(showDataGridTopbar, () => nextTick(observeDataGridTopbarWidth), { immediate: true }); watch( [