automerge-classic
automerge-classic copied to clipboard
DocSet connection reset document data
I need to create a document with some content and then establish a connection with another remote document that is initially empty and has the same document id.
Since the second document which is remote and empty is created later than the 1st one (that is with the content), as soon as the connection is established between DocSet objects 1st document content is getting overridden by the empty document on the other side of the connection.
Is there any way that I can change this behavior so a new document that is created and connected over (using automerge connection) to the original document ends up with the same content as the original document?
Hey, I got similar issues as well but then I was able to figure out what's going on. The reset is probably a conflict and you can access the "overriden" state by using Automerge.getConflicts()
method (an example).
Although I was not able to keep the conflict after a save
& load
cycle (which can be explained by the following behavior in the docs: The next time you assign to a conflicting property, the conflict is automatically considered to be resolved, and the conflict disappears from the object returned by Automerge.getConflicts()
.
Great thanks matrushka I'm going to try that out.
meanwhile I added a step to persist the initial copy on server-side and always load the initial copy from the server before sync as a work around.