-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
isFetching is always true when useQueries have duplicate query #8224
Comments
Would you mind explaining what the cause is? It sounds somewhat different from #4187, where The codesandbox reproduction of this issue has no |
we don’t support same keys in the array because a) it doesn’t achieve anything - why would you do that, it’s just redundant and b) we use the keys to keep track of where a query is in the array to support detection of changed keys, and it just doesn’t work if there are items that have the same key hash. |
@TkDodo Sorry to comment on a closed issue, but you were asking (perhaps rhetorically) "why would you do that, it’s just redundant", and I believe I have a use case that could answer your question. We need to support an arbitrary number of columns, each representing an object that needs to be loaded. We still need to run all these queries in a single component, because the ordering of the rows might depend on multiple columns. And lastly, adding the same column twice is in our case a valid use case. Because of how hooks work, I need to combine all of these queries in a single I understand this is an edge case, and I'm built my own helper to combine and re-spread the queries and their results in the right way. I just wanted to document this use case if anyone ever ask why would someone do that in the future. Oh and I also believe that your documentation is out of date. In the useQueries documentation, the warning simply says:
I believe this should be re-worded to make clear that having duplicate keys is NOT supported at all. |
Describe the bug
isFetching
,isLoading
is always true when useQueries have duplicate queryYour minimal, reproducible example
https://codesandbox.io/p/sandbox/elegant-kapitsa-c3c357
Steps to reproduce
Expected behavior
expect
isFetching
andisLoading
to be falseHow often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
macOs 15.0.1
Tanstack Query adapter
react-query
TanStack Query version
5.59.16
TypeScript version
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: