@onehat/data 1.20.2 → 1.20.3

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.20.2",
3
+ "version": "1.20.3",
4
4
  "description": "JS data modeling package with adapters for many storage mediums.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -1036,7 +1036,10 @@ class AjaxRepository extends Repository {
1036
1036
  this.assembleTreeNodes();
1037
1037
  this.emit('changeData', this.entities);
1038
1038
  } else if (this.isRemotePhantomMode && (this._operations.add || this._operations.deletePhantom)) {
1039
- // 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!
1039
+ if (this._operations.add) {
1040
+ // Do nothing, as we don't want to immediately reload on add for a remote phantom mode record.
1041
+ // The entity wouldn't appear, and it would cause all kinds of trouble!
1042
+ }
1040
1043
  if (this._operations.deletePhantom) {
1041
1044
  // sweep existing deleted records and remove them
1042
1045
  _.each(this.entities, (entity) => {
@@ -340,6 +340,9 @@ class OneBuildRepository extends AjaxRepository {
340
340
 
341
341
 
342
342
  const duplicateEntity = await this.createStandaloneEntity(root, true, true);
343
+ if (entity.isRemotePhantomMode) {
344
+ entity.isRemotePhantom = true;
345
+ }
343
346
  this._insertBefore(duplicateEntity, entity);
344
347
 
345
348
  this.markLoading(false);
@@ -1716,6 +1716,10 @@ export default class Repository extends EventEmitter {
1716
1716
  break;
1717
1717
  case 'edit':
1718
1718
  entities = this.getDirty();
1719
+ if (_.isEmpty(entities) && this.isRemotePhantomMode) {
1720
+ // In remote phantom mode, we need to save phantoms even if they're not dirty
1721
+ entities = this.getPhantom();
1722
+ }
1719
1723
  if (useStaged) {
1720
1724
  entities = this.getStaged(entities);
1721
1725
  }