Skip to content

useQueries() causes infinite rerenders since @tanstack/[email protected] #9638

@jpreis

Description

@jpreis

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions