by zachallaun · 8y ago · 0 comments
// Pretend doc1 and doc2 are already Automerge objects
let doc1 = { x: 1 }
let doc2 = { x: 2 }
// x will be either 1 or 2 (arbitrarily chosen), but
// res1 will always == res2 regardless of choice
let res1 = Automerge.merge(doc1, doc2)
let res2 = Automerge.merge(doc2, doc1)
res1 == res2 // true
However, there may be cases where you want to manually resolve conflicts, and if that is the case, the `_conflicts` property is there so that you can undo whatever merge occurred automatically and set the "winner" yourself.doc1 = { 'a': {'b': {'c': ... }}}
doc2 = {}
So one has been deleted entirely and the other has modified some attribute deep down inside of it.
If you always have to check and resolve conflicts yourself, then it's not really useful.