Skip to content
Source
Sign inSign up
TanStack/query

useQueries() causes infinite rerenders since @tanstack/react-query@5.85.9 #9638

Send to my agent
Closedjpreis(GitHub profile, opens in a new tab) opened this issue 0 comments

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

  1. Open Devtools
  2. Click on "Remove id2"
  3. 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

  1. TkDodo closed this

Sign in to join this conversation.