TanStack / TanStack/query

[Bug?]: Result type of combine works not as expected

Open
#7,522 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

package: solid-query types
Dominant language
TypeScript
Stars
50.3k
Forks
4.2k
Avg merge
18h 25m
Merged PRs (30d)
200

Description

Describe the bug

I have already posted a question to the discord: https://discord.com/channels/719702312431386674/1003327027849474198/1247640278987309058

Unfortunately no one answered in the thread and in the meanwhile I'm pretty sure that this is an incorrect result type.

Steps to reproduce
    return createQueries(() => {
      const list = ["test1", "test2"];
      return ({
        queries: list .map((key) => ({
          queryKey: ["key", key],
          queryFn: () => true,
        })),
        combine: (results) => ({
          data: results.every(result => result.data)
        })
      });
    });
Expected behavior

As already said in the discord thread. I expect to just return a combined data and all other fields like isPending, isError and so on should be automatically handled by tanstack query. And if this is not possible, because I think in react it doesn't do that, it should be possible to freely define this result, because when we look at the react documentation (https://tanstack.com/query/latest/docs/framework/react/reference/useQueries#combine) clearly only uses data and pending

How often does this bug happen?

Every time

Screenshots or Videos

image

Platform

OS: Windows
Browser: Chrome
Node: v21.7.3

Tanstack Query adapter

solid-query

TanStack Query version

5.40.0

TypeScript version

No response

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the TypeScript reproduction in the issue and compare Solid Query's inferred combined result with the linked React useQueries combine documentation. Resolve the intended contract for combined data and status fields, then verify the reported result type against that contract with a regression check.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.