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

fix(QueriesObserver): include default options on duplicate query, queryHash check #8432

Merged
merged 2 commits into from
Jan 6, 2025

Conversation

nick-avi-say
Copy link
Contributor

@nick-avi-say nick-avi-say commented Dec 12, 2024

This commit fixes the issue logged here
fixes #8431

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', ], }, ])

Copy link
Collaborator

@TkDodo TkDodo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks. can you please add a test that fails on main but works with your fix so that we don’t introduce a regression later.

Copy link
Collaborator

@TkDodo TkDodo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I missed that this was behind the env check. It’s fine without a test 👍

Copy link

nx-cloud bot commented Jan 6, 2025

View your CI Pipeline Execution ↗ for commit c6c4c61.

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ❌ Failed 4m 6s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 1m 8s View ↗

☁️ Nx Cloud last updated this comment at 2025-01-06 18:19:17 UTC

Copy link

pkg-pr-new bot commented Jan 6, 2025

Open in Stackblitz

More templates

@tanstack/angular-query-devtools-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-devtools-experimental@8432

@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@8432

@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@8432

@tanstack/angular-query-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-experimental@8432

@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@8432

@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@8432

@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@8432

@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@8432

@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@8432

@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@8432

@tanstack/react-query-devtools

npm i https://pkg.pr.new/@tanstack/react-query-devtools@8432

@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@8432

@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@8432

@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@8432

@tanstack/solid-query-devtools

npm i https://pkg.pr.new/@tanstack/solid-query-devtools@8432

@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@8432

@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@8432

@tanstack/svelte-query-devtools

npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@8432

@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@8432

@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@8432

@tanstack/vue-query-devtools

npm i https://pkg.pr.new/@tanstack/vue-query-devtools@8432

commit: c6c4c61

@TkDodo TkDodo merged commit e664d22 into TanStack:main Jan 6, 2025
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Duplicate Queries found" warning, incorrectly logging when creating a QueriesObserver instance
2 participants