@onehat/data 1.18.3 → 1.18.4
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
package/src/Repository/Ajax.js
CHANGED
|
@@ -798,7 +798,7 @@ class AjaxRepository extends Repository {
|
|
|
798
798
|
|
|
799
799
|
// Delete it from this.entities
|
|
800
800
|
const id = entity.id;
|
|
801
|
-
this.entities = _.filter(this.entities, (entity) => entity.id
|
|
801
|
+
this.entities = _.filter(this.entities, (entity) => entity.id !== id);
|
|
802
802
|
entity.destroy();
|
|
803
803
|
});
|
|
804
804
|
}
|
|
@@ -974,6 +974,14 @@ class AjaxRepository extends Repository {
|
|
|
974
974
|
if (!this.eventsPaused) {
|
|
975
975
|
if (this.isRemotePhantomMode && (this._operations.add || this._operations.deletePhantom)) {
|
|
976
976
|
// Do nothing, as we don't want to immediately reload on add for a remote phantom mode record. It won't appear, and it will cause all kinds of trouble!
|
|
977
|
+
if (this._operations.deletePhantom) {
|
|
978
|
+
// sweep existing deleted records and remove them
|
|
979
|
+
_.each(this.entities, (entity) => {
|
|
980
|
+
if (entity.isDeleted && entity.isDestroyed) {
|
|
981
|
+
this.removeEntity(entity);
|
|
982
|
+
}
|
|
983
|
+
})
|
|
984
|
+
}
|
|
977
985
|
} else if (this._operations.add || this._operations.delete) {
|
|
978
986
|
this.reload();
|
|
979
987
|
} else {
|
|
@@ -1818,7 +1818,9 @@ export default class Repository extends EventEmitter {
|
|
|
1818
1818
|
*/
|
|
1819
1819
|
removeEntity(entity) { // standard function notation so it can be called by child class via super.removeEntity
|
|
1820
1820
|
this.entities = _.filter(this.entities, e => e !== entity);
|
|
1821
|
-
entity.
|
|
1821
|
+
if (!entity.isDestroyed) {
|
|
1822
|
+
entity.destroy();
|
|
1823
|
+
}
|
|
1822
1824
|
}
|
|
1823
1825
|
|
|
1824
1826
|
/**
|