subscriptions - optimistic updates #1423
-
Is it possible to do subscriptions with optimistic updates? This is necessary as the DOM does not get updated until the subscription returns data back. Updating the DOM first, optimistically, would result in a fast, immediate, responsive app. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 11 replies
-
Hey, This sound a bit counter-intuitive, a subscription isn't meant to have a predictable result, it's more that you are subscribed to a certain entity like a chat that can have updates at any given time, this way you can stay up-to-date with you updating stuff in other tabs or another user sending a message. What is your use case specifically for "optimistic responses" in subscriptions. I understand the case for mutations where we know what we are changing, for instance we change a todo.title to be value y and we can change that in the cache before the server responds. |
Beta Was this translation helpful? Give feedback.
Hey,
This sound a bit counter-intuitive, a subscription isn't meant to have a predictable result, it's more that you are subscribed to a certain entity like a chat that can have updates at any given time, this way you can stay up-to-date with you updating stuff in other tabs or another user sending a message.
What is your use case specifically for "optimistic responses" in subscriptions.
I understand the case for mutations where we know what we are changing, for instance we change a todo.title to be value y and we can change that in the cache before the server responds.