With live subscriptions, has anyone centred on a good approach for handling multi-user edits of text that is stored on graph.cool? (collaborative editing)
a
agartha
06/09/2017, 8:32 AM
@phil I tried something. Created a Type to receive deltas. Used event hooks to merge changes into the source document (in another Type), client has subscription on the source document Type, so receives update after every persisted change. Client also needs the same logic to merge the received updated document with the local changes.
p
phil
06/09/2017, 10:49 AM
Super interesting. Thanks @agartha
phil
06/09/2017, 10:50 AM
How complex would you say that was to implement? And are you finding this a stable approach?
a
agartha
06/09/2017, 10:52 AM
Not actively using it, did it as a PoC, actually before Graphcool, to prove the pattern worked.
agartha
06/09/2017, 10:52 AM
It's easy to implement if you already have the business logic for the merge, because that's the hardest part
agartha
06/09/2017, 11:00 AM
I extended it to do locking as well, I have the pattern ready, but I never got around to implement it. On the client, when the user sets focus on a field, I would add a lock record to a child Type, with information about the user, the record, and the active field, subscribe all clients to receive lock updates, update the UI accordingly (by making fields read-only). That prevented most of the merge conflicts.