@speckle/objectloader 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +5 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -143,7 +143,7 @@ export default class ObjectLoader {
|
|
|
143
143
|
|
|
144
144
|
// 2) Iterate through obj
|
|
145
145
|
for( let prop in obj ) {
|
|
146
|
-
if( typeof obj[prop] !== 'object' ) continue // leave alone primitive props
|
|
146
|
+
if( typeof obj[prop] !== 'object' || obj[prop] === null ) continue // leave alone primitive props
|
|
147
147
|
|
|
148
148
|
if( obj[prop].referencedId ) {
|
|
149
149
|
obj[prop] = await this.getObject( obj[prop].referencedId )
|
|
@@ -242,7 +242,7 @@ export default class ObjectLoader {
|
|
|
242
242
|
// split into 5%, 15%, 40%, 40% (5% for the high priority children: the ones with lower minDepth)
|
|
243
243
|
let splitBeforeCacheCheck = [ [], [], [], [] ]
|
|
244
244
|
let crtChildIndex = 0
|
|
245
|
-
|
|
245
|
+
|
|
246
246
|
for ( ; crtChildIndex < 0.05 * childrenIds.length; crtChildIndex++ ) {
|
|
247
247
|
splitBeforeCacheCheck[0].push( childrenIds[ crtChildIndex ] )
|
|
248
248
|
}
|
|
@@ -261,7 +261,7 @@ export default class ObjectLoader {
|
|
|
261
261
|
|
|
262
262
|
let newChildren = []
|
|
263
263
|
let nextCachePromise = this.cacheGetObjects( splitBeforeCacheCheck[ 0 ] )
|
|
264
|
-
|
|
264
|
+
|
|
265
265
|
for ( let i = 0; i < 4; i++ ) {
|
|
266
266
|
let cachedObjects = await nextCachePromise
|
|
267
267
|
if ( i < 3 ) nextCachePromise = this.cacheGetObjects( splitBeforeCacheCheck[ i + 1 ] )
|
|
@@ -343,7 +343,7 @@ export default class ObjectLoader {
|
|
|
343
343
|
readPromisses[i] = crtReadPromise
|
|
344
344
|
})
|
|
345
345
|
}
|
|
346
|
-
|
|
346
|
+
|
|
347
347
|
while ( true ) {
|
|
348
348
|
let validReadPromises = readPromisses.filter(x => x != null)
|
|
349
349
|
if ( validReadPromises.length === 0 ) {
|
|
@@ -424,7 +424,7 @@ export default class ObjectLoader {
|
|
|
424
424
|
let store = this.cacheDB.transaction('objects', 'readonly').objectStore('objects')
|
|
425
425
|
let idbChildrenPromises = idsChunk.map( id => this.promisifyIdbRequest( store.get( id ) ).then( data => ( { id, data } ) ) )
|
|
426
426
|
let cachedData = await Promise.all(idbChildrenPromises)
|
|
427
|
-
|
|
427
|
+
|
|
428
428
|
// console.log("Cache check for : ", idsChunk.length, Date.now() - t0)
|
|
429
429
|
|
|
430
430
|
for ( let cachedObj of cachedData ) {
|