localdb-ces6q 0.2.55 → 0.2.57
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/LocalDB.js +23 -21
- 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
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
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].
|
790
|
+
indexes[indexName].deleteKeys(prevDocs);
|
795
791
|
}
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
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
|
}
|