localdb-ces6q 0.2.56 → 0.2.57

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/dist/LocalDB.js +23 -21
  2. package/package.json +1 -1
package/dist/LocalDB.js CHANGED
@@ -778,32 +778,34 @@ export class LocalDB {
778
778
  prevDocs.push(prev);
779
779
  foreignComputeArgs.push({ next: null, prev });
780
780
  }
781
- // update data
782
- this._collections = {
783
- ...collections,
784
- [colName]: nextCol,
785
- };
786
- // update indexes
787
- const indexes = this._indexes[colName];
788
- for (let indexName in indexes) {
789
- indexes[indexName].deleteKeys(prevDocs);
790
- }
791
- this._txRollbacks.push(() => {
781
+ if (prevDocs.length) {
782
+ // update data
783
+ this._collections = {
784
+ ...collections,
785
+ [colName]: nextCol,
786
+ };
787
+ // update indexes
792
788
  const indexes = this._indexes[colName];
793
789
  for (let indexName in indexes) {
794
- indexes[indexName].setPairs(prevDocs.map((d) => [d, d]), true);
790
+ indexes[indexName].deleteKeys(prevDocs);
795
791
  }
796
- });
797
- // update undo history
798
- if (this._undoable && !this._inUndoOrRedo) {
799
- this._txOps.push({
800
- undo: { op: 'setDocs', args: [colName, prevDocs] },
801
- redo: { op: 'deleteDocs', args: [colName, ids] },
792
+ this._txRollbacks.push(() => {
793
+ const indexes = this._indexes[colName];
794
+ for (let indexName in indexes) {
795
+ indexes[indexName].setPairs(prevDocs.map((d) => [d, d]), true);
796
+ }
797
+ });
798
+ // update undo history
799
+ if (this._undoable && !this._inUndoOrRedo) {
800
+ this._txOps.push({
801
+ undo: { op: 'setDocs', args: [colName, prevDocs] },
802
+ redo: { op: 'deleteDocs', args: [colName, ids] },
803
+ });
804
+ }
805
+ this._config[colName].foreignComputes?.forEach((compute) => {
806
+ compute.compute(this, foreignComputeArgs);
802
807
  });
803
808
  }
804
- this._config[colName].foreignComputes?.forEach((compute) => {
805
- compute.compute(this, foreignComputeArgs);
806
- });
807
809
  // end tx
808
810
  this.endTx(txKey);
809
811
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "localdb-ces6q",
3
- "version": "0.2.56",
3
+ "version": "0.2.57",
4
4
  "description": "TypeScript ECMAScript Module Library Template",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",