Replies: 3 comments 7 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.
-
|
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.
-
|
Hey, my 2 cents: Sometimes a mutation can return SSE, for instance I have a form data request of a CSV that imports data. on the backend this takes a bit depending on the size of the csv. i could split the call and persist the file in the backend, start a job, etc but that is sometimes overkill. instead, my request returns SSE, so i can display a progress bar in the frontend or something similar |
Beta Was this translation helpful? Give feedback.
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
queryOptionswith design similar to tRPC:As you can see,
queryFnit checks if the response hasasyncIteratorand performsclient.setQueryDatafor 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
mutationFnthen? It seems like there is no way to access the client.Thanks!
Beta Was this translation helpful? Give feedback.
All reactions