diff --git a/src/JSONNestedNode.js b/src/JSONNestedNode.js index fea227c..799ffda 100644 --- a/src/JSONNestedNode.js +++ b/src/JSONNestedNode.js @@ -110,7 +110,7 @@ export default class JSONNestedNode extends React.Component { } shouldComponentUpdate(nextProps, nextState) { - return !!Object.keys(nextProps).find(key => + return !!Array.find(Object.keys(nextProps), key => key !== 'circularCache' && (key === 'keyPath' ? nextProps[key].join('/') !== this.props[key].join('/') : diff --git a/src/getCollectionEntries.js b/src/getCollectionEntries.js index d9c27d9..8b3ce3c 100644 --- a/src/getCollectionEntries.js +++ b/src/getCollectionEntries.js @@ -18,7 +18,9 @@ function getEntries(type, collection, sortObjectKeys, from=0, to=Infinity) { if (type === 'Object') { let keys = Object.getOwnPropertyNames(collection); - if (typeof sortObjectKeys !== 'undefined') { + if (sortObjectKeys === true) { + keys.sort(); + } else { keys.sort(sortObjectKeys); } diff --git a/src/index.js b/src/index.js index 3d4b074..85b5c54 100644 --- a/src/index.js +++ b/src/index.js @@ -109,13 +109,13 @@ export default class JSONTree extends React.Component { } componentWillReceiveProps(nextProps) { - if (['theme', 'invertTheme'].find(k => nextProps[k] !== this.props[k])) { + if (Array.find(['theme', 'invertTheme'], k => nextProps[k] !== this.props[k])) { this.setState(getStateFromProps(nextProps)); } } shouldComponentUpdate(nextProps) { - return !!Object.keys(nextProps).find(k => ( + return !!Array.find(Object.keys(nextProps), k => ( k === 'keyPath' ? nextProps[k].join('/') !== this.props[k].join('/') : nextProps[k] !== this.props[k]