From 2ecdfbd24e9094fa8d5a854f51db134f0b396da0 Mon Sep 17 00:00:00 2001 From: Andros Rosa Llop Date: Mon, 25 Nov 2019 15:24:20 -0400 Subject: [PATCH] [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. --- src/plugin-hooks/usePagination.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugin-hooks/usePagination.js b/src/plugin-hooks/usePagination.js index 08cdcd1..d029859 100755 --- a/src/plugin-hooks/usePagination.js +++ b/src/plugin-hooks/usePagination.js @@ -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 {