Skip to content

Commit

Permalink
fix(json-crdt-extensions): 🐛 allow any value in MV-Register
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Mar 4, 2024
1 parent 0a01ade commit 990dc92
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/json-crdt-extensions/mval/ValueMvApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class ValueMvApi extends NodeApi<ValueMv> implements ExtensionApi<ValueMv
const rgaApi = new ArrApi(node.data, api);
const length = rgaApi.length();
rgaApi.del(0, length);
rgaApi.ins(0, [builder.constOrJson(json)]);
rgaApi.ins(0, [builder.json(json)]);
rgaApi.node.removeTombstones();
return this;
}
Expand Down
10 changes: 5 additions & 5 deletions src/json-crdt-extensions/mval/__demos__/usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* npx nodemon -q -x ts-node src/json-crdt-extensions/mval/__demos__/usage.ts
*/

import {Model} from '../../../json-crdt';
import {Model, s} from '../../../json-crdt';
import {ValueMvExt} from '..';

console.clear();
Expand All @@ -17,7 +17,7 @@ model.ext.register(ValueMvExt)

model.api.root({
obj: {
mv: ValueMvExt.new(1),
mv: ValueMvExt.new(s.con(1)),
},
});

Expand All @@ -27,7 +27,7 @@ console.log(model + '');

const api = model.api.in(['obj', 'mv']).asExt(ValueMvExt);

api.set(5);
api.set(s.con(5));

console.log('');
console.log('After update:');
Expand All @@ -37,8 +37,8 @@ const model2 = model.fork();

const api2 = model2.api.in(['obj', 'mv']).asExt(ValueMvExt);

api.set(10);
api2.set(20);
api.set(s.con(10));
api2.set(s.con(20));
model.applyPatch(model2.api.flush());

console.log('');
Expand Down

0 comments on commit 990dc92

Please sign in to comment.