0
Fork 0
mirror of https://github.com/TanStack/query.git synced 2026-11-16 22:50:20 +00:00
query/docs/framework/angular/reference/functions/experimental_streamedQuery.md
Wonsuk Choi 992c94234c
docs(query-core): inline option type aliases in generated reference docs (#11534)
* docs(query-core): inline option type aliases in generated reference docs

* docs(query-core): inline retry, notify and remaining option aliases
2026-09-18 17:08:56 +09:00

1.6 KiB

id title
experimental_streamedQuery experimental_streamedQuery
function experimental_streamedQuery<TQueryFnData, TData, TQueryKey>(streamFn: StreamedQueryParams<TQueryFnData, TData, TQueryKey>): (context: object) => TData | Promise<TData>;

Defined in: packages/query-core/src/streamedQuery.ts:75

This is a helper function to create a query function that streams data from an AsyncIterable. Data will be an Array of all the chunks received. The query will be in a 'pending' state until the first chunk of data is received, but will go to 'success' after that. The query will stay in fetchStatus 'fetching' until the stream ends.

Type Parameters

TQueryFnData

TQueryFnData = unknown

TData

TData = TQueryFnData[]

TQueryKey

TQueryKey extends readonly unknown[] = readonly unknown[]

Parameters

streamFn

StreamedQueryParams<TQueryFnData, TData, TQueryKey>

The function that returns an AsyncIterable to stream data from.

Returns

(context: object): TData | Promise<TData>;

Parameters

context

client

QueryClient

direction?

unknown

Deprecated

if you want access to the direction, you can add it to the pageParam

meta

Record<string, unknown> | undefined

pageParam?

unknown

queryKey

TQueryKey

signal

AbortSignal

Returns

TData | Promise<TData>

Example

await queryClient.query({
  queryKey: ['data'],
  queryFn: streamedQuery({
    streamFn: fetchDataInChunks,
  }),
})