Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

streamedQuery does not work with useInfiniteQuery #8866

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

Closed
lukedukeus opened this issue Mar 27, 2025 · 1 comment
Closed

streamedQuery does not work with useInfiniteQuery #8866

lukedukeus opened this issue Mar 27, 2025 · 1 comment

Comments

@lukedukeus
Copy link

lukedukeus commented Mar 27, 2025

Describe the bug

streamedQuery does not work with useInfiniteQuery.

streamedQuery returns QueryFunction<Array<TQueryFnData>, TQueryKey>, but useInfinitQuery expects a queryFn with type QueryFunction<TQueryFnData, TQueryKey, TPageParam> | SkipToken

If this is by design, or there is some logical reason why this shouldn't be possible feel free to convert it to a discussion

Steps to reproduce

const query = useInfiniteQuery({
  queryKey: ['data'],
  queryFn: streamedQuery({
    queryFn: fetchDataInChunks,
  }),
})

Expected behavior

I would expect to useInfiniteQuery, and new data from a streamed query is automatically added to the last page of results that useInfiniteQuery returns.

Tanstack Query adapter

react-query

TanStack Query version

v5.69.0

@TkDodo
Copy link
Collaborator

TkDodo commented Mar 27, 2025

yes, this is a known limitation. it can’t work with infinite queries, we’d need a separate version streamedInfniteQuery. I’m holding back because we’d need this to make it work:

@TanStack TanStack locked and limited conversation to collaborators Mar 27, 2025
@TkDodo TkDodo converted this issue into discussion #8867 Mar 27, 2025

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants