Skip to content

Commit

Permalink
Fix sorting issue with memo and virtualization (#310)
Browse files Browse the repository at this point in the history
Problem:
When using `memoMode = "row"` and table virtualization, when sorting a column, row positioning may not be correctly updated if the row existed (in DOM?) before the sort AND after the sort.

Fix:
Add additional check to `propsAreEqual` function for the `Memo_MRT_TableBodyRow` to check if the row index has changed.
  • Loading branch information
duckboy81 authored Jan 10, 2023
1 parent 0c890bf commit aa72893
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -165,5 +165,5 @@ export const MRT_TableBodyRow: FC<Props> = ({

export const Memo_MRT_TableBodyRow = memo(
MRT_TableBodyRow,
(prev, next) => prev.row === next.row,
(prev, next) => (prev.row === next.row && prev.rowIndex === next.rowIndex),
);

2 comments on commit aa72893

@vercel
Copy link

@vercel vercel bot commented on aa72893 Jan 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on aa72893 Jan 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.