@onehat/data 1.22.4 → 1.22.5
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 +1 -1
- package/src/Repository/Tree.js +17 -12
package/package.json
CHANGED
package/src/Repository/Tree.js
CHANGED
|
@@ -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
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
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
|
-
|
|
199
|
-
|
|
200
|
-
|
|
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
|
|
213
|
+
return treeNode;
|
|
209
214
|
})
|
|
210
215
|
.finally(() => {
|
|
211
216
|
this.markLoading(false);
|