Skip to content

Commit 1ad035d

Browse files
committed
fix: unnecessary setPageIndex to the last page when pageIndex is 0
1 parent 258d6ae commit 1ad035d

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)