|
|
|
|
|
by zachallaun
3061 days ago
|
|
From my reading of the docs, Automerge will arbitrarily pick a "winning" document in the case of a conflict, but guarantees that the same winner will be chosen if the merge were to occur, for instance, in a different order: // 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.