Open aran opened 11 months ago
This is most likely caused because at the moment autosurgeon
assumes that you will use it in a loop where you hydrate
, make modifications to the data, and then reconcile
, without changing the document in between. This is important for splice
because it accumulates updates based on the state of the document at the time you called hydrate
.
However, we do have the facilities in automerge
to perform updates as at some point in time now (the API is a bit awkward but it can be done), so the solution is to save the heads in the Text
at the time that we call hydrate
and then when we call reconcile
apply the changes as at the given heads.
Here is some working code with AutoCommit
If I change the type of the doc from AutoCommit to Automerge, and use a transaction: