You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GraphQL schema doesn't convey full information about data interdependencies and relations. So it is possible to have some pieces of data stale with delta sync. Quick example:
Say some comment is deleted and we are notified about it via a DELETE event. Three things are stale now:
Reference to this comment in Post.comments field
Post.commentCount field is also stale as it has to be decremented on comment delete
Category.totalCommentCount - same
When this happens there should be a way to update specific fields of related nodes. So in addition to UPDATE and DELETE events (targeting individual nodes), we need UPDATE_FIELDS event that can notify us about specific node fields that had changed.
This event would generate dynamic new NODE_ query that will only fetch the mentioned fields and update the node. So it will look something like this:
Additionally maybe allow fields to be a fragment, i.e.:
{eventName: "UPDATE_FIELDS",remoteTypeName: "Post",remoteId: {__typename: "Post",id: "1"},fields: `fragment ChangedFields on Post { commentCount, comments { __typename } }`},
Technically we can update related nodes fully. But that can be pretty heavy in some cases, so more targeted updates can be useful in performance-sensitive scenarios.
The text was updated successfully, but these errors were encountered:
GraphQL schema doesn't convey full information about data interdependencies and relations. So it is possible to have some pieces of data stale with delta sync. Quick example:
Say some comment is deleted and we are notified about it via a
DELETE
event. Three things are stale now:Post.comments
fieldPost.commentCount
field is also stale as it has to be decremented on comment deleteCategory.totalCommentCount
- sameWhen this happens there should be a way to update specific fields of related nodes. So in addition to
UPDATE
andDELETE
events (targeting individual nodes), we needUPDATE_FIELDS
event that can notify us about specific node fields that had changed.This event would generate dynamic new
NODE_
query that will only fetch the mentioned fields and update the node. So it will look something like this:Additionally maybe allow
fields
to be a fragment, i.e.:Technically we can update related nodes fully. But that can be pretty heavy in some cases, so more targeted updates can be useful in performance-sensitive scenarios.
The text was updated successfully, but these errors were encountered: