From e39f85ff4bcd45993a65fba6b01a9ef1aac30df8 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 29 Oct 2024 09:56:06 +0100 Subject: [PATCH] fix: refs #8078 improve handleSelection --- src/components/VnTable/VnTable.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 1e949120f..dc8671369 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -335,10 +335,13 @@ function handleScroll() { function handleSelection({ evt, added, rows: selectedRows }, rows) { if (evt?.shiftKey && added) { const rowIndex = selectedRows[0].$index; - selected.value.length = 0; + const selectedIndexes = new Set(selected.value.map((row) => row.$index)); for (const row of rows) { if (row.$index == rowIndex) break; - selected.value.push(row); + if (!selectedIndexes.has(row.$index)) { + selected.value.push(row); + selectedIndexes.add(row.$index); + } } } }