Replies: 2 comments 6 replies
-
Try using optimistic updates🚀https://tanstack.com/query/v4/docs/framework/react/guides/optimistic-updates If you’re not sure, feel free to ask any questions. |
Beta Was this translation helpful? Give feedback.
3 replies
-
FYI, for queries, we now have a built-in abstraction:
I’m questioning if this needs to be a mutation. retrieving a response to a question isn’t really mutating something? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I work on a library that handles normal responses as well as streamed ones, represented as async iterable. I've implemented
queryOptions
with design similar to tRPC:As you can see,
queryFn
it checks if the response hasasyncIterator
and performsclient.setQueryData
for each chunk.It works great, but in real work, streamed data is going to come out from mutation. For example, if you submit a form that sends request to the server to retrieve streamed LLM completion.
How would I implement
mutationFn
then? It seems like there is no way to access the client.Thanks!
Beta Was this translation helpful? Give feedback.
All reactions