Skip to content
Source
Sign inSign up
TanStack/query

useSuspenseQueries does not accept array of UseSuspenseQueryOptions #8390

Send to my agent
ClosedArnagos(GitHub profile, opens in a new tab) opened this issue 3 comments

Describe the bug

It's not possible to call useSuspenseQueries with an array of UseSuspenseQueryOptions / SuspenseQueryOptions: Image

Your minimal, reproducible example

https://codesandbox.io/p/devbox/rough-brook-drv2hx

Steps to reproduce

const [{ error, data }] = useSuspenseQueries({
  queries: [getSuspenseQueryOptions()],
});

function getSuspenseQueryOptions(): UseSuspenseQueryOptions<ValueType,  ErrorType> {
  return {};
}

type ValueType = { some: string; value: string };
type ErrorType = { error: unknown };

Expected behavior

UseSuspenseQueryOptions can be used in useSuspenseQueries

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

Windows 11 Any browser

Tanstack Query adapter

react-query

TanStack Query version

5.62.2

TypeScript version

5.7.2

Additional context

No response

  1. TkDodo added labelstypes

  2. @TkDodo This error already appears in the first version of 5. The types seem to have been generally incompatible since their inception. I can't use queryOptions because a large part of our endpoints get generated via Orval. I'll have to create an issue there as well.

    FYI: The error does not appear when using the normal QueryOptions, only SuspenseQueryOptions. However because of the recent skipToken changes, we can't use this workaround anymore.

  3. gonna close this since the recommended solution is to use queryOptions. As for orval, I would suggest that they should start to have an option to emit queryOptions instead of useQuery hooks. This is the syntax other tools like trpc are also going towards

  4. TkDodo closed this

  5. TkDodo added labelshas workaround

Sign in to join this conversation.