RIFT-15726 - optimize download size -> lodash usage in UI
[osm/UI.git] / skyquake / plugins / composer / src / src / libraries / model / DescriptorModel.js
index 02bbfcd..eb70e2a 100644 (file)
@@ -20,7 +20,7 @@
  * Created by onvelocity on 8/23/15.
  */
 
-import _ from 'lodash'
+import _isArray from 'lodash/isArray'
 import guid from '../guid'
 import Position from '../graph/Position'
 import IconFactory from './IconFactory'
@@ -182,7 +182,10 @@ export default class DescriptorModel {
                        throw new ReferenceError('child must be an instance of DescriptorModel class');
                }
                if (this.findChildByUid(child.uid)) {
-                       throw new ReferenceError('child already exists');
+                       console.warn('Child already exists');
+                       // NOTE: Commented out this line because it was causing issues with Internal VLD.
+                       // TODO: Check why it caused issues with Internal VLD
+                       // throw new ReferenceError('child already exists');
                }
                if (child.parent instanceof DescriptorModel) {
                        throw new ReferenceError('child already has a parent');
@@ -276,7 +279,7 @@ export default class DescriptorModel {
 
        updateModelList(modelFieldName, modelFieldValue, descriptorClass = DescriptorModel, newItemAddedSuccessCallback = () => {}) {
                // value can be Array of (DescriptorModel | json model), DescriptorModel, or json model
-               if (_.isArray(modelFieldValue)) {
+               if (_isArray(modelFieldValue)) {
                        this.model[modelFieldName] = modelFieldValue.map(d => d instanceof descriptorClass ? d.model : d);
                        return true;
                }