Skip to content
Source
Sign inSign up
TanStack/query

Cannot use initialData in queryOptions with useSuspenseQueries #8657

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

Describe the bug

The error shows when we use queryOptions with initialData inside useSuspenseQueries.

const query1 = queryOptions({
  queryKey: ['key1'],
  queryFn: () => 'Query Data',
  initialData: 'initial data',
})

const queryResults = useSuspenseQueries({ queries: [query1] })

Is it intended? If not, I want to fix this issue.

Your minimal, reproducible example

Steps to reproduce

  1. Write the code on your text editor.
  2. You will see the error.

Expected behavior

No error should be shown.

How often does this bug happen?

Every time

Screenshots or Videos

Image

Platform

macOS VS Code

Tanstack Query adapter

None

TanStack Query version

5.66.3

TypeScript version

No response

Additional context

No response

  1. TkDodo added labelstypes

  2. not intended, no. I think it’s related to our overload for initialData. I’d appreciate a PR that fixes it 🙏

  3. not intended, no. I think it’s related to our overload for initialData. I’d appreciate a PR that fixes it 🙏

    Okay, I will work on it. Thank you!

  4. TkDodo closed this

Sign in to join this conversation.