Realm GraphQL client subscription receives complete results list for 1 modification

(Eric) #1

Using the realm-graphql-client, how is it possible to receive more granular info regarding changes to a results list, instead of receiving the entire list again?

(i.e. If I have a subscription to an array on ROS and a new item is added to this array on the ROS - I just want the new item info to the client, not the entire array again)

Having trouble finding this use case in GraphQL documentation or Apollo. But it works in the Realm JavaScript:

Collection notifications contain information that describe what changes have occurred at a fine-grained level. This consists of the indices of objects that have been inserted, deleted, or modified since the last notification. Collection notifications are delivered asynchronously: first with the initial results, and then after any write transaction which modifies any of the objects in the collection, deletes objects from the collection, or adds new objects to the collection.

Is this functionality available with realm-graphql-client?


(Eric) #2

Hello, just following up on this request. I need to know whether it is possible to subscribe to changes in a long list when a new item is added to the list. There is a large initial download of the object, followed by tiny incremental changes.

Can realm-graphql-client do it?

(Eric) #3

Following up again one more time before the weekend. Please see above and offer any assistance you can - It’s greatly appreciated when you do!

(Eric) #4

Is this thread not being answered because

  1. The answer is so plainly easy to see in the documentation that I should be able to find it myself
  2. I should be opening a support ticket for this
  3. Realm is busy handling higher tier customers
  4. All of the above
  5. Other

Thanks, Eric

(Nikola Irinchev) #5

Hi Eric,

Sorry for taking so long to respond - it’s the summer season, so we have less people in the office and most of those are focused on handling support tickets (forums do come at lower priority compared to our support portal).

In any case, back to your question - there’s no way to request more granular updates with the GraphQL API at this time. The reason is that it was modeled to integrate easily with React apps where you just update the state with the new collection and don’t deal with manually keeping track of what changed and how. Obviously, as you’ve noticed, the downside is that you’re transferring much more data than strictly necessary. One way to mitigate that is to paginate the data and to only request properties that are strictly needed for your current view. For example, if you have a list of contacts, you may construct a query that requests the first 100 objects and of those, it takes just the name and the profile picture url. Then if the user navigates to a single contact, you can create another query that requests the full details, but only for one object.

If having granular updates is critical for your business, please reach out to your sales rep or open a ticket on and someone from the support will take it up from there and work with management to prioritize it accordingly.