Storing Undo History In a Syncd Realm


#1

I am making a personal notes app on Mac using a Realm database.
I would like this to sync across devices in the future.

I am currently implementing undo.
I would like a recent set of model updates to be persisted as undoable actions between uses of the app.

When it comes to syncing in future, I obviously need to guarantee that Realm will sync the model and deal with conflicts in a way that keeps the undo-history and model state aligned.

So, say I create an Undo Realm object that holds a List of undo objects.

If I insert an undo object at the top of the list in the same transaction as I alter the model, can I guarantee that when a sync happens the undo list is spliced together in a way that matches the way all the model transactions have been integrated by the sync logic?


#2

@Giles Yes we will splice the list together - we have probably spent the most time on our merge operation for lists and perfecting that. We use vector clocks to infer causality to resolve conflicts. You can see the details here -
https://docs.realm.io/sync/realm-sync-a-primer