Stringify JSON value before rendering in AttributeValue
authorFrank Bessou <frank.bessou@logilab.fr>
Mon, 18 Dec 2017 16:10:33 +0100
changeset 255 ba56a53b0abd
parent 254 100978264f6e
child 256 46911701ee61
Stringify JSON value before rendering in AttributeValue When a JSON value can't be rendered using React components, its raw value is used. That makes the application crash when the value is an object. In this changeset, we ensure that the displayed value is always a string.
src/components/Attribute.js
--- a/src/components/Attribute.js	Thu Jul 06 10:12:26 2017 +0200
+++ b/src/components/Attribute.js	Mon Dec 18 16:10:33 2017 +0100
@@ -15,7 +15,7 @@
         } else if (attribute.basicType() === 'array') {
             attrView = (<ArrayValue attribute={attribute} />);
         } else {
-            attrView = value;
+            attrView = JSON.stringify(value);
         }
     } else {
         attrView = '<unspecified>';