Skip to content

experimental_prefetchInRender doesn't work with useQueries #9988

@OliverJAsh

Description

@OliverJAsh

Describe the bug

const query = queryOptions({
  queryKey: ['foo'],
  queryFn: async () => [],
  experimental_prefetchInRender: true,
});

const Example: FC = () => {
  // ✅ This finishes loading.
  // const { promise } = useQuery(query);

  // ❌ This never finishes loading.
  const [{ promise }] = useQueries({ queries: [query] });

  React.use(promise);

  return <div>loaded</div>;
};

Your minimal, reproducible example

https://stackblitz.com/edit/tanstack-query-5j76gubf?file=src%2Findex.tsx&preset=node

Steps to reproduce

See above.

Expected behavior

experimental_prefetchInRender works with useQueries.

How often does this bug happen?

None

Screenshots or Videos

No response

Platform

N/A

Tanstack Query adapter

None

TanStack Query version

5.90.12

TypeScript version

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions