DEV Community

Discussion on: GraphQL Live Queries with Socket.io

Collapse
 
ianberdin profile image
Ruslan Ianberdin

Hi Laurin!

Thank you for the amazing work. I really liked the idea and implementation.

Can I question you something?
Let's say there is a chat with a list of messages.
The user edited one of them by setTitle messages(id: 1, msg: "new content").
If I understood correctly, then we are doing liveQueryStore.invalidate ('Query.messages').
But this will re-request and re-render all the messages again, right? Or is there a hope that React will update only part of it thanks to the Virtual DOM? And if the rendering is more complex, where there is a lot of logic and it is expensive to run every time?

Collapse
 
ianberdin profile image
Ruslan Ianberdin

And what about multiple root queries?
‘Query { messages, users, comments, settings, workspaces, permissions }’

Collapse
 
n1ru4l profile image
Laurin Quast

Updates can be sent in patches. Optimizations must be done in user-land as this is not a concern of this library. However, clients like relay already do that optimization for your. You can check out the relay and apollo example over here and observe re-renders with the react dev tools! github.com/n1ru4l/graphql-live-que... and