@@ -2,11 +2,11 @@ import { MutableContentEvents } from '../../model/mutable/MutableObject';
22import { HashedObject } from '../../model/immutable/HashedObject' ;
33import { Hash } from '../../model/hashing/Hashing' ;
44import { MutationOp } from 'data/model/mutable/MutationOp' ;
5- import { HashedSet } from 'data/model/immutable/HashedSet' ;
5+ import { HashedSet , HashedSetLiteralized } from 'data/model/immutable/HashedSet' ;
66import { HashReference } from 'data/model/immutable/HashReference' ;
77import { Logger , LogLevel } from 'util/logging' ;
88import { MultiMap } from 'util/multimap' ;
9- import { ClassRegistry } from 'data/model' ;
9+ import { ClassRegistry , Context } from 'data/model' ;
1010import { BaseCollection , Collection , CollectionConfig , CollectionOp } from './Collection' ;
1111import { Identity } from 'data/identity' ;
1212
@@ -209,14 +209,17 @@ class MutableSet<T> extends BaseCollection<T> implements Collection<T> {
209209
210210 exportMutableState ( ) {
211211 return {
212- _elements : this . _elements ,
213- _currentAddOpRefs : this . _currentAddOpRefs
212+ _elements : Object . fromEntries ( this . _elements . entries ( ) ) ,
213+ _currentAddOpRefs : Object . fromEntries ( [ ... this . _currentAddOpRefs . entries ( ) ] . map ( ( [ key , value ] ) => [ key , value . literalize ( ) ] ) )
214214 } ;
215215 }
216216
217- importMutableState ( state : any ) : void {
217+ importMutableState ( state : {
218+ _elements : { [ key : string ] : T } ,
219+ _currentAddOpRefs : { [ key : string ] : { value : HashedSetLiteralized } }
220+ } ) : void {
218221 this . _elements = new Map ( Object . entries ( state . _elements ) ) ;
219- this . _currentAddOpRefs = new Map ( Object . entries ( state . _currentAddOpRefs ) ) ;
222+ this . _currentAddOpRefs = new Map ( Object . entries ( state . _currentAddOpRefs ) . map ( ( [ key , value ] ) => [ key , HashedSet . deliteralize ( value , new Context ( ) ) ] ) ) ;
220223 }
221224
222225 async validate ( references : Map < Hash , HashedObject > ) {
0 commit comments