@@ -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 ;
@@ -437,8 +440,11 @@ abstract class HashedObject {
437440
438441 static collectDirectSubobjects ( path : string , value : any , subobjects : Map < string , HashedObject > ) {
439442
440- let typ = typeof ( value ) ;
443+ // console.log('called collectDirectSubobjects() w/path', path, 'subobjects: ', subobjects.size);
444+ // console.log(new Error().stack?.length)
441445
446+ let typ = typeof ( value ) ;
447+
442448 // We're only concerned with 'object' typed stuff, since scalars, strings, etc. cannot yield
443449 // any HashedObject-derived subobjects.
444450
@@ -478,9 +484,11 @@ abstract class HashedObject {
478484 //return this.getSubObjects(context, true);
479485
480486 const subobjects = new Map < string , HashedObject > ( ) ;
481-
482- 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 ) {
483490 if ( fieldName . length > 0 && fieldName [ 0 ] !== '_' ) {
491+ // console.log('getDirectSubObjects', fieldName, this)
484492 let value = ( this as any ) [ fieldName ] ;
485493
486494 HashedObject . collectDirectSubobjects ( fieldName , value , subobjects ) ;
0 commit comments