Closed salzhrani closed 5 years ago
@salzhrani @samio nice catch, there's definitely something fishy going on. Thank you for the tests!
when I try to remove a key a get an error here. it seems that dots
are undefined on dotStore
. and it might get sorted out whenever this gets addressed.
after an attempt at debugging it seems that this line returns false
after removing a
causing the om
key state not being set, thus the whole state for the ORMap
becoming {}
rreplica.applySub('om', 'ormap', 'applySub', 'a', 'mvreg', 'write', 'A1')
// state { om: a: [['A1']] }
expect(rreplica.value().om.a).to.deep.equal(new Set(['A1']))
// pass
rreplica.applySub('om', 'ormap', 'remove', 'a')
// state {}, both 'om' and 'a' sub-states gone
@salzhrani that line is required because we need to test that the removal supersedes the content. I'm not sure about what should be the fix here, will have to think a bit about this one...
@salzhrani I've been discussing this issue, and it looks like it's a consequence of how the ORMap works.
Because the absence of a key is defined by the value of the CRDT it points to being at the "bottom", which is the case.
Looks like this is a "feature" (that should be explained in the README).
Anyway, nice catch!
@pgte I changed the test to show the problem we are currently running into. I don't think it is related to the "bottom" behaviour.
This is happening because a lwwreg
is not a causal CRDT.
In the docs you can check which causal CRDTs support being embedded:
https://github.com/ipfs-shipyard/js-delta-crdts#maps
Thank you. Sorry for taking more of your time.
No worries, thanks for reporting this!
Not sure if embedding
ormap
inside anormap
is supported. but adding seems to work fine ... removing fails. this PR adds failing tests