@onehat/data 1.22.24 → 1.22.26
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/package.json +1 -1
- package/src/Repository/Ajax.js +2 -11
- package/src/Repository/OneBuild.js +1 -1
package/package.json
CHANGED
package/src/Repository/Ajax.js
CHANGED
|
@@ -480,28 +480,19 @@ class AjaxRepository extends Repository {
|
|
|
480
480
|
const
|
|
481
481
|
currentEntityCount = this.entities.length,
|
|
482
482
|
newPageSize = this.pageSize;
|
|
483
|
-
|
|
484
483
|
if (this.page === 1 && currentEntityCount >= newPageSize && this.isPaginated) {
|
|
485
484
|
// Optimization: if we're on page 1 and already have enough entities
|
|
486
485
|
// for the new page size, just truncate the existing data instead of reloading
|
|
487
486
|
const entitiesToRemove = this.entities.splice(newPageSize);
|
|
488
|
-
|
|
489
487
|
entitiesToRemove.forEach(entity => entity.destroy());
|
|
490
|
-
|
|
491
488
|
this._setPaginationVars();
|
|
492
|
-
|
|
493
489
|
this.emit('changeData', this.entities);
|
|
494
|
-
|
|
495
490
|
if (this.debugMode) {
|
|
496
491
|
console.log(`Truncated entities from ${currentEntityCount} to ${newPageSize}`);
|
|
497
492
|
}
|
|
498
493
|
} else {
|
|
499
494
|
// We need more data or we're not on page 1, so reload
|
|
500
|
-
|
|
501
|
-
return this.loadRootNodes();
|
|
502
|
-
} else {
|
|
503
|
-
return this.reload();
|
|
504
|
-
}
|
|
495
|
+
return this.reload();
|
|
505
496
|
}
|
|
506
497
|
}
|
|
507
498
|
}
|
|
@@ -521,7 +512,7 @@ class AjaxRepository extends Repository {
|
|
|
521
512
|
* @fires beforeLoad,changeData,load,error
|
|
522
513
|
*/
|
|
523
514
|
async load(params, callback = null) {
|
|
524
|
-
if (this.isTree
|
|
515
|
+
if (this.isTree) {
|
|
525
516
|
return this.loadRootNodes();
|
|
526
517
|
}
|
|
527
518
|
if (this.isDestroyed) {
|
|
@@ -144,7 +144,7 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
144
144
|
.catch(error => {
|
|
145
145
|
// Don't log or throw error if request was aborted
|
|
146
146
|
if (error.name === 'AbortError' || error.code === 'ERR_CANCELED') {
|
|
147
|
-
return Promise.reject(
|
|
147
|
+
return Promise.reject('Request cancelled');
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
if (this.debugMode) {
|