Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Duplicate Queries found" warning, incorrectly logging when creating a QueriesObserver instance #8431

Open
nick-avi-say opened this issue Dec 12, 2024 · 1 comment

Comments

@nick-avi-say
Copy link

Describe the bug

The duplicate keys check occurs prior to default options being set on the queries which generates the queryHash.

The below contains 2 unique query key's. However the duplicate keys warning logs since these queries are checked as-is and they do not yet have a queryHash.

const observer = new QueriesObserver(queryClient, [ { queryKey: [ 'Hippo', 'Layout', 'detail', 'id1', ], }, { queryKey: [ 'Hippo', 'Layout', 'detail', 'id2', ], }, ])

Your minimal, reproducible example

https://codesandbox.io/p/sandbox/55fr36

Steps to reproduce

  1. Create a QueryObserver instance with 2 queries with 2 unique keys. Do not provide a custom queryHash.
  2. View the warning in your console

(CTA set up to do this for you in the codesandbox)

Expected behavior

We expect unique keys to not throw a duplicate key console warning.

How often does this bug happen?

None

Screenshots or Videos

No response

Platform

All

Tanstack Query adapter

None

TanStack Query version

v5.62.7

TypeScript version

No response

Additional context

No response

@nick-avi-say
Copy link
Author

Added a PR here
#8432

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant