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

useSuspenseQueries does not accept array of UseSuspenseQueryOptions #8390

Open
Arnagos opened this issue Dec 3, 2024 · 2 comments
Open

useSuspenseQueries does not accept array of UseSuspenseQueryOptions #8390

Arnagos opened this issue Dec 3, 2024 · 2 comments
Labels

Comments

@Arnagos
Copy link

Arnagos commented Dec 3, 2024

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

@TkDodo TkDodo added the types label Dec 3, 2024
@Arnagos
Copy link
Author

Arnagos commented Dec 4, 2024

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants