Skip to content

Commit a6c227d

Browse files
authored
Fix missing deps in useEffect doing page index outbound check (#1257)
While loading the totalRowCount is 0 resulting in setPageIndex(-1). The 'return' on first line should be hit.
1 parent 5706e54 commit a6c227d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export const useMRT_Effects = <TData extends MRT_RowData>(
7373
if (firstVisibleRowIndex >= totalRowCount) {
7474
table.setPageIndex(Math.ceil(totalRowCount / pageSize) - 1);
7575
}
76-
}, [totalRowCount]);
76+
}, [totalRowCount, enablePagination, isLoading, showSkeletons]);
7777

7878
//turn off sort when global filter is looking for ranked results
7979
const appliedSort = useRef<MRT_SortingState>(sorting);

0 commit comments

Comments
 (0)