@onehat/data 1.7.8 → 1.7.9

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onehat/data",
3
- "version": "1.7.8",
3
+ "version": "1.7.9",
4
4
  "description": "JS data modeling package with adapters for many storage mediums.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -834,6 +834,9 @@ class AjaxRepository extends Repository {
834
834
  * @private
835
835
  */
836
836
  _finalizeSave = (promises) => {
837
+ if (!promises.length) {
838
+ return;
839
+ }
837
840
  return this.axios.all(promises)
838
841
  .then(this.axios.spread((...batchOperationResults) => {
839
842
  // All requests are now complete
@@ -1398,7 +1398,9 @@ export default class Repository extends EventEmitter {
1398
1398
  if (this.combineBatch) {
1399
1399
 
1400
1400
  result = this.batchAsSynchronous ? await this._doBatchAdd(entities) : this._doBatchAdd(entities);
1401
- results.push(result);
1401
+ if (result) {
1402
+ results.push(result);
1403
+ }
1402
1404
 
1403
1405
  } else {
1404
1406
  for (i = 0; i < entities.length; i++) {
@@ -1411,7 +1413,9 @@ export default class Repository extends EventEmitter {
1411
1413
  }
1412
1414
 
1413
1415
  result = this.batchAsSynchronous ? await this._doAdd(entity) : this._doAdd(entity);
1414
- results.push(result);
1416
+ if (result) {
1417
+ results.push(result);
1418
+ }
1415
1419
  }
1416
1420
  }
1417
1421
  }
@@ -1425,7 +1429,9 @@ export default class Repository extends EventEmitter {
1425
1429
  if (this.combineBatch) {
1426
1430
 
1427
1431
  result = this.batchAsSynchronous ? await this._doBatchEdit(entities) : this._doBatchEdit(entities);
1428
- results.push(result);
1432
+ if (result) {
1433
+ results.push(result);
1434
+ }
1429
1435
 
1430
1436
  } else {
1431
1437
  for (i = 0; i < entities.length; i++) {
@@ -1438,7 +1444,9 @@ export default class Repository extends EventEmitter {
1438
1444
  }
1439
1445
 
1440
1446
  result = this.batchAsSynchronous ? await this._doEdit(entity) : this._doEdit(entity);
1441
- results.push(result);
1447
+ if (result) {
1448
+ results.push(result);
1449
+ }
1442
1450
  }
1443
1451
  }
1444
1452
  }
@@ -1452,7 +1460,9 @@ export default class Repository extends EventEmitter {
1452
1460
  if (this.combineBatch) {
1453
1461
 
1454
1462
  result = this.batchAsSynchronous ? await this._doBatchDelete(entities) : this._doBatchDelete(entities);
1455
- results.push(result);
1463
+ if (result) {
1464
+ results.push(result);
1465
+ }
1456
1466
 
1457
1467
  } else {
1458
1468
  for (i = 0; i < entities.length; i++) {
@@ -1463,7 +1473,9 @@ export default class Repository extends EventEmitter {
1463
1473
  } else {
1464
1474
  result = this.batchAsSynchronous ? await this._doDelete(entity) : this._doDelete(entity);
1465
1475
  }
1466
- results.push(result);
1476
+ if (result) {
1477
+ results.push(result);
1478
+ }
1467
1479
  }
1468
1480
  }
1469
1481
  }