[Fix] defaultGetResetPageDeps should listen to data, not rows (#1658)

Related to: https://github.com/tannerlinsley/react-table/issues/1657

Discussion: https://spectrum.chat/react-table/general/v7-maximum-update-depth-exceeded-usegroupby-useexpanded-with-usepagination~2c25e2b8-7a61-4c32-84b3-87db458701c2

Thanks to @iamjon for identifying usePagination was the culprit.
I then checked the last changes made to it, and noticed it was previously listening to data and now it listened to rows (which I believe is a new reference on each render), causing infinite loop on one of its effects.

I tested this change on my project and everything seems ok now.
This commit is contained in:
Andros Rosa Llop 2019-11-25 15:24:20 -04:00 committed by Tanner Linsley
parent 461aa0df96
commit 2ecdfbd24e

View File

@ -17,10 +17,10 @@ export const usePagination = hooks => {
usePagination.pluginName = 'usePagination'
const defaultGetResetPageDeps = ({
rows,
data,
manualPagination,
state: { filters, groupBy, sortBy },
}) => [manualPagination ? null : rows, filters, groupBy, sortBy]
}) => [manualPagination ? null : data, filters, groupBy, sortBy]
function useMain(instance) {
const {