Skip to content

Commit

Permalink
fix: subrow reset sorting (fix #5103) (#5112)
Browse files Browse the repository at this point in the history
* Sorting subrows unintentionally updates CoreRowModel subrows. Do
  a deeper copy when beginning to sort instead.
  • Loading branch information
itsmejoeeey authored Oct 6, 2023
1 parent a7e7aa0 commit aa6da95
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/table-core/src/utils/getSortedRowModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function getSortedRowModel<TData extends RowData>(): (
const sortData = (rows: Row<TData>[]) => {
// This will also perform a stable sorting using the row index
// if needed.
const sortedData = [...rows]
const sortedData = rows.map(row => ({...row}))

sortedData.sort((rowA, rowB) => {
for (let i = 0; i < availableSorting.length; i += 1) {
Expand Down

0 comments on commit aa6da95

Please sign in to comment.