Skip to content

Commit 00ff51e

Browse files
Update src/DataGrid.tsx
Co-authored-by: Nicolas Stepien <[email protected]>
1 parent 3b78830 commit 00ff51e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/DataGrid.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,8 +770,10 @@ export function DataGrid<R, SR = unknown, K extends Key = Key>(props: DataGridPr
770770
if (draggedOverRowIdx === undefined) return;
771771

772772
const { rowIdx } = selectedPosition;
773-
const startRowIndex = rowIdx < draggedOverRowIdx ? rowIdx + 1 : draggedOverRowIdx;
774-
const endRowIndex = rowIdx < draggedOverRowIdx ? draggedOverRowIdx + 1 : rowIdx;
773+
const [startRowIndex, endRowIndex] =
774+
rowIdx < draggedOverRowIdx
775+
? [rowIdx + 1, draggedOverRowIdx + 1]
776+
: [draggedOverRowIdx, rowIdx];
775777
updateRows(startRowIndex, endRowIndex);
776778
setDraggedOverRowIdx(undefined);
777779
}

0 commit comments

Comments
 (0)