Skip to content

Commit 09edf0e

Browse files
committed
2 parents fbd2c41 + dcb0a8a commit 09edf0e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/data/model/immutable/HashedObject.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ abstract class HashedObject {
4848
private _signOnSave : boolean;
4949
private _lastHash? : Hash;
5050
private _lastSignature? : string;
51+
public _objectID : Number;
5152

5253
private _resources? : Resources;
5354

@@ -57,6 +58,7 @@ abstract class HashedObject {
5758
protected _cascadeMutableContentEvents: boolean;
5859

5960
constructor() {
61+
this._objectID = Math.random()
6062
this._derivedFields = new Set();
6163
this._signOnSave = false;
6264
this._boundToStore = false;
@@ -289,6 +291,7 @@ abstract class HashedObject {
289291
}
290292

291293
setResources(resources: Resources, seen: Set<HashedObject> = new Set()): void {
294+
if (this._resources === resources) return;
292295
if (seen?.has(this)) return;
293296

294297
this._resources = resources;
@@ -441,7 +444,7 @@ abstract class HashedObject {
441444
//console.log(new Error().stack);
442445

443446
let typ = typeof(value);
444-
447+
445448
// We're only concerned with 'object' typed stuff, since scalars, strings, etc. cannot yield
446449
// any HashedObject-derived subobjects.
447450

@@ -481,9 +484,11 @@ abstract class HashedObject {
481484
//return this.getSubObjects(context, true);
482485

483486
const subobjects = new Map<string, HashedObject>();
484-
485-
for (const fieldName of Object.keys(this)) {
487+
const objectKeys = Object.keys(this)
488+
// console.log('getDirectSubObjects: iterating over', objectKeys.length, 'keys')
489+
for (const fieldName of objectKeys) {
486490
if (fieldName.length > 0 && fieldName[0] !== '_') {
491+
// console.log('getDirectSubObjects', fieldName, this)
487492
let value = (this as any)[fieldName];
488493

489494
HashedObject.collectDirectSubobjects(fieldName, value, subobjects);

0 commit comments

Comments
 (0)