Infinite Fetching Issue with useQueries on Param Changes #8503
-
Hello React Query community, I’ve been encountering an issue with useQueries in my project. Every time the params object changes, the queries (usersByRoleQueries) start fetching indefinitely. Below is the relevant code snippet:
The usersByRoleQueries are created dynamically using the roleIds and the params object, which updates whenever search parameters change. However, this seems to cause an infinite fetching loop. What I’ve tried so far:
Questions:
I’d appreciate any guidance or suggestions. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
seems fine, except that the useEffect is totally unnecessary. Why would you copy the params to state instead of depending on the params directly? |
Beta Was this translation helpful? Give feedback.
seems fine, except that the useEffect is totally unnecessary. Why would you copy the params to state instead of depending on the params directly?