Skip to content

Commit 2b79055

Browse files
committed
fixed bug on HashedObject's clone: meta props _lastSignature and _signOnSave were only being copied to the clone's root object, not its fields
1 parent c7cead2 commit 2b79055

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/data/model/immutable/HashedObject.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,17 +246,20 @@ abstract class HashedObject {
246246
}
247247

248248
clone() : this {
249-
let c = this.toContext();
249+
const c = this.toContext();
250250

251+
const current = c.objects;
252+
251253
c.objects = new Map<Hash, HashedObject>();
252254

253255
let clone = HashedObject.fromContext(c) as this;
254256

255-
clone.init();
257+
for (const [hash, obj] of current.entries()) {
258+
const clonedObj = c.objects.get(hash) as HashedObject;
259+
clonedObj._signOnSave = obj._signOnSave;
260+
clonedObj._lastSignature = obj._lastSignature;
261+
}
256262

257-
clone._signOnSave = this._signOnSave;
258-
clone._lastSignature = this._lastSignature;
259-
260263
return clone;
261264
}
262265

0 commit comments

Comments
 (0)