streamedQuery
Hi all.
I've found the streamedQuery helper in the docs but I was wondering from where does the import come from?
https://tanstack.com/query/latest/docs/reference/streamedQuery#streamedquery
streamedQuery | TanStack Query Docs
streamedQuery is a helper function to create a query function that streams data from an . Data will be an Array of all the chunks received. The query will be in a pending state until the first chunk o...
7 Replies
like-goldOP•8mo ago
Oh I've found it 😄 experimental_streamedQuery is the export. Now the question is only if this is still considered experimental or nah? It's under the API references without any notice for experimental in the docs - but the export is { streamedQuery as experimental_streamedQuery } . Any info on this?
grumpy-cyan•8mo ago
I made it experimental so that we can change the API if needed
Docs should reflect that though, would appreciate a PR
Definitely try it out please. It can actually be built in user-land, too, so there's nothing magical about it
But yes we need people to try it before we can remove experimental
like-goldOP•8mo ago
Will create a PR for the docs then 😉 Mach'ma 😉
grumpy-cyan•8mo ago
Ha, fellow Austrian 🇦🇹 ?
like-goldOP•8mo ago
Not quite 😄 Born in Slovenia but I've moved to Austria in 2011 - so kinda 😉 Oida 😄
I wanted to ask regarding the streamedQuery -> I'm trying to get my head around it and if I understand correctly ( correct me if I'm wrong ), the query channel gets closed right? Or does it stay open and the query state changes when new data streams in? Or am I going about it wrong?
Oh I've just got it - it streams! Oh boy 😄 Me likey 😄 Now I just have to figure out the parsing of the data and for it to be reactive 🙂 Is there a way to then checked the parsed data of the query? getQueryData maybe?
grumpy-cyan•8mo ago
what do you mean with "check the parsed data" ?
like-goldOP•8mo ago
The thing is that I've got a BE that sends a keep alive message every 3mins ( I need to ignore this ). And then a message when a BE change was made to which I have to react to - meaning I've got to provide the message as an json. when json changes I've got a popup I have to trigger. And the second req is that every 8hr ( depends on server setting ) I have to popup that alert dialog. So basically I want to parse the messages and set those as the query data ( overwritting it )...
basically the question is how can I parse the iterable...
Morgen @TkDodo 🔮 . Sry was a bit under pressure the last days. Will do the PR sometime this week. And I'll be testing the streamedQuery a bit - to maybe expand on the example in the docs. Cheers!