Skip to content

Commit

Permalink
Fix missing deps in useEffect doing page index outbound check
Browse files Browse the repository at this point in the history
While loading the totalRowCount is 0 resulting in setPageIndex(-1).
The 'return' on first line should be hit.
  • Loading branch information
nsteenbeek authored Oct 3, 2024
1 parent 317a87c commit 5db5c4a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/material-react-table/src/hooks/useMRT_Effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const useMRT_Effects = <TData extends MRT_RowData>(
if (firstVisibleRowIndex >= totalRowCount) {
table.setPageIndex(Math.ceil(totalRowCount / pageSize) - 1);
}
}, [totalRowCount]);
}, [totalRowCount, enablePagination, isLoading, showSkeletons]);

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

0 comments on commit 5db5c4a

Please sign in to comment.