-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removing outer elements in nested Vec
produces unexpected results
#23
Comments
This is due to a possibly surprising feature of the "reconcile with the value at the same location" will do different things depending on the Now, you can avoid this behavior by adding a key for the nested sequences, this would require a newtype for the nested This is clearly surprising behavior, I'm not sure what a better default would be though. It's possible that in almost all cases you will want a key and so we should make not providing a key an opt in (I haven't thought through in practice how that would be done, or if it can be done with the current |
I see, thanks for the explanation! I better understand the problem now. As you said, I'm not sure either if there's a better default. Perhaps it would be enough to document this more, although to be fair, re-reading the documentation for |
By the way, digging more into this, I realized that |
I agree that |
I've noticed what I think is a bug in
autosurgeon
.In the test that follows, I create a data structure with a
Vec
of 3 strings, fork it, remove one element in one document and another in the other document, then merge them back and get a document where both elements are removed, as expected:However, in the next test, I do the exact same, but the document contains a
Vec
of threeVec
s of bytes. Here, the results are different: we get a document with two elements, in which some values are scrambled. Note that I'm aware of the existence ofByteVec
, but for this example I'm not using them.I tried doing things manually with
automerge
, i.e. creating a document with nested lists, forking, removing elements, and merging again, but I don't get any weird results there, which leads me to conclude thatautosurgeon
's implementation must have an issue somewhere---or perhaps that I misunderstood something.Same test again, using `automerge` directly:
The text was updated successfully, but these errors were encountered: