ignored undefined nodes in array/objects

This commit is contained in:
dzannotti 2015-08-11 21:54:08 +01:00
parent 626562ad5a
commit 65d9e5831b
3 changed files with 8 additions and 3 deletions

View File

@ -61,7 +61,10 @@ export default class JSONArrayNode extends React.Component {
if (typeof this.props.previousData !== 'undefined') {
prevData = this.props.previousData[idx];
}
childNodes.push(grabNode(idx, element, prevData, this.props.theme));
const node = grabNode(idx, element, prevData, this.props.theme);
if (node !== false) {
childNodes.push(node);
}
});
this.needsChildNodes = false;
this.renderedChildren = childNodes;

View File

@ -62,7 +62,10 @@ export default class JSONObjectNode extends React.Component {
if (typeof this.props.previousData !== 'undefined') {
prevData = this.props.previousData[k];
}
childNodes.push(grabNode(k, obj[k], prevData, this.props.theme));
const node = grabNode(k, obj[k], prevData, this.props.theme);
if (node !== false) {
childNodes.push(node);
}
}
}
this.needsChildNodes = false;

View File

@ -23,6 +23,5 @@ export default function(key, value, prevValue, theme) {
} else if (nodeType === 'Null') {
return <JSONNullNode keyName={key} previousValue={prevValue} theme={theme} value={value} key={aKey} />;
}
console.error('Unknown node type:', nodeType);
return false;
}