Fix serialization of a leaf-list field.
[osm/UI.git] / skyquake / plugins / composer / src / src / libraries / model / DescriptorModelMetaFactory.js
index 69098ec..1ba8912 100644 (file)
@@ -102,19 +102,15 @@ function serialize_leaf_empty(data) {
 function serialize_leaf_list(data) {
        data = data[this.name];
        if (data) {
-               commaSeparatedValues = data.reduce((d, v) => {
-                       let leaf = Serializer.leaf.call(this, d);
-                       let value = leaf & leaf[this.name];
-                       if (value && value.length) {
-                               if (v.length) {
-                                       v += ', ';
-                               }
-                               v += value;
+               data = data.reduce((result, value) => {
+                       if (value !== '' && value !== null && value !== undefined && typeof value !== 'object') {
+                               result.push(value);
                        }
-               }, "");
-               if (commaSeparatedValues.length) {
+                       return result;
+               }, []);
+               if (data.length){
                        let obj = {};
-                       obj[this.name] = commaSeparatedValues;
+                       obj[this.name] = data;
                        return obj;
                }
        }