streamedQuery 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.
const query = queryOptions({
queryKey: ['data'],
queryFn: streamedQuery({
queryFn: fetchDataInChunks,
}),
})
const query = queryOptions({
queryKey: ['data'],
queryFn: streamedQuery({
queryFn: fetchDataInChunks,
}),
})
Options