TanStack / query

🤖 Powerful asynchronous state management, server-state utilities and data fetching for the web. TS/JS, React Query, Solid Query, Svelte Query and Vue Query.
https://tanstack.com/query
MIT License
42.09k stars 2.86k forks source link

`result` parameter in `combine` function in `useQueries` initially empty array #6612

Closed dhulme closed 9 months ago

dhulme commented 9 months ago

Describe the bug

The result parameter in combine function in React useQueries is initially an empty array. This doesn't match the typing that says each item is a UseQueryResult.

Your minimal, reproducible example

https://codesandbox.io/p/devbox/divine-pine-l3nw5l

Steps to reproduce

Run example and look in the console, it shows an error (see screenshot below).

For an unknown reason, the code works in code sandbox, but not when I run the same code example on my machine or my colleague's machine. Please could you try and reproduce locally copying the 3 files in the example?

Expected behavior

I expect queries to be defined on first render, but I receive undefined

How often does this bug happen?

Every time

Screenshots or Videos

Error shown on Chrome on my machine: image

Platform

Tanstack Query adapter

react-query

TanStack Query version

v5.15.3

TypeScript version

No response

Additional context

No response

TkDodo commented 9 months ago

For an unknown reason, the code works in code sandbox, but not when I run the same code example on my machine or my colleague's machine.

not sure what's up with the sandbox, but it's somehow using an older version of react-query.

here is a fork with an update to the latest version that shows the issue:

this seems like a regression from:

I need to see if I can fix that issue differently.