Skip to content

Cannot use initialData in queryOptions with useSuspenseQueries #8657

@gs18004

Description

@gs18004

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions