Skip to content

Commit

Permalink
chore: fix row selection when sorted
Browse files Browse the repository at this point in the history
  • Loading branch information
stdavis committed Nov 29, 2024
1 parent f9ec2b1 commit 464404f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function InnerTable(
const isCellSelected = row.getIsSelected();
if (e.shiftKey) {
const { rows } = getRowModel();
const rowsToToggle = getRowRange(rows, row.index, lastSelectedIndex.current);
const rowsToToggle = getRowRange(rows, index, lastSelectedIndex.current);
setRowSelection(Object.fromEntries(rowsToToggle.map((r) => [r.id, !isCellSelected])));
} else if (e.metaKey || e.ctrlKey) {
const newSelection = structuredClone(rowSelection);
Expand All @@ -140,7 +140,7 @@ function InnerTable(
}

if (!isCellSelected) {
lastSelectedIndex.current = row.index;
lastSelectedIndex.current = index;
}
}
: undefined
Expand Down

0 comments on commit 464404f

Please sign in to comment.