Skip to content

Commit 33cda81

Browse files
Merge pull request #471 from StinsonZhao/v2
fix: unnecessary setPageIndex to the last page when pageIndex is 0
2 parents ccc62b3 + 1ad035d commit 33cda81

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/mantine-react-table/src/hooks/useMRT_Effects.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export const useMRT_Effects = <TData extends MRT_RowData>(
7171
if (!enablePagination || isLoading || showSkeletons) return;
7272
const { pageIndex, pageSize } = pagination;
7373
const firstVisibleRowIndex = pageIndex * pageSize;
74-
if (firstVisibleRowIndex >= totalRowCount) {
74+
if (firstVisibleRowIndex >= totalRowCount && firstVisibleRowIndex > 0) {
7575
table.setPageIndex(Math.ceil(totalRowCount / pageSize) - 1);
7676
}
7777
}, [totalRowCount]);

0 commit comments

Comments
 (0)