Describe the bug#
We've noticed a bug in useQueries() that was introduced in version 5.85.9.
Dynamically updating the list of queries passed to useQueries() causes an infinite rerender, but curiously only if the last element of the list is removed.
Minimal Codesandbox examples:
It is still broken in the latest version. We suspect this change to be the culprit.
Your minimal, reproducible example#
https://codesandbox.io/p/devbox/8ffffc?file=%2Fsrc%2FApp.tsx
Steps to reproduce#
- Open Devtools
- Click on "Remove id2"
- Check render count
When removing id1, no infinite rerenders occur.
Expected behavior#
No infinite rerenders when updating the list passed to useQueries()
How often does this bug happen?#
None
Screenshots or Videos#
No response
Platform#
- OS: macOS
- Browser: Chrome, v139.0.7258.155
Tanstack Query adapter#
react-query
TanStack Query version#
v5.85.9
TypeScript version#
v5.7.2
Additional context#
No response