@onehat/data 1.22.4 → 1.22.6

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.22.4",
3
+ "version": "1.22.6",
4
4
  "description": "JS data modeling package with adapters for many storage mediums.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -126,7 +126,7 @@ JsonProperty.className = 'Json';
126
126
  JsonProperty.type = 'json';
127
127
 
128
128
 
129
- // For the sake of OneBuild, create an alias of Json, that's Tag
129
+ // For the sake of OneBuild backwards compatibility, create an alias of Json, that's Tag
130
130
  export class TagProperty extends JsonProperty {}
131
131
  TagProperty.className = 'Tag';
132
132
  TagProperty.type = 'tag';
@@ -354,7 +354,8 @@ class OneBuildRepository extends AjaxRepository {
354
354
 
355
355
  if (!success) {
356
356
  this.markLoading(false);
357
- throw Error(message);
357
+ this.throwError(message);
358
+ return;
358
359
  }
359
360
 
360
361
  // Click duplicateId. The new row appears directly above the one that was duplicated
@@ -186,26 +186,31 @@ class TreeRepository extends OneBuildRepository {
186
186
  this.throwError(message);
187
187
  return;
188
188
  }
189
+
189
190
 
190
191
  // Set the current entities
191
- const oThis = this;
192
- const children = _.map(root, (data) => {
193
- const entity = Repository._createEntity(oThis.schema, data, this, true);
194
- oThis._relayEntityEvents(entity);
195
- return entity;
192
+ const children = [];
193
+ _.each(root, (data) => {
194
+ if (data.id === treeNode.id) {
195
+ // This is the node we're loading, so update it directly
196
+ treeNode.loadOriginalData(data);
197
+ return null;
198
+ }
199
+ const entity = Repository._createEntity(this.schema, data, this, true);
200
+ this._relayEntityEvents(entity);
201
+ children.push(entity);
196
202
  });
197
-
198
- this.entities = this.entities.concat(children);
199
-
200
- this.assembleTreeNodes();
201
-
202
- this._setPaginationVars();
203
+ if (children.length) {
204
+ this.entities = this.entities.concat(children);
205
+ this.assembleTreeNodes();
206
+ this._setPaginationVars();
207
+ }
203
208
 
204
209
  this.rehash();
205
210
  // this.emit('changeData', this.entities);
206
211
  this.emit('load', this);
207
212
 
208
- return children;
213
+ return treeNode;
209
214
  })
210
215
  .finally(() => {
211
216
  this.markLoading(false);