Infinite loop when server-side paging with redux dispatch in fetchData function #3725
Unanswered
edwinhaver
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
I am using the example code "Pagination (Controlled)" for server-side pagination, however as soon as I use the dispatch method of redux in the main fetchData function that is passed to the table, then it keeps on triggering fetchData. Does anyone know why that is and how to stop this behaviour?
This is the fetchData function that is passed to the table:
And this is the useEffect in the Table component to trigger the fetchData function:
pageIndex and pageSize do not change but it seems that it is caused by the dispatch in the fetchData function as when I remove it this behaviour is not there.
Note that the dispatch queries the country collection and the data is passed to the Table component. The following statement listens to the changed data:
const data = useMemo(() => countries, [countries])
Beta Was this translation helpful? Give feedback.
All reactions