Skip to content
This repository was archived by the owner on May 14, 2020. It is now read-only.

Commit e9fed4a

Browse files
committed
Calculate shouldExpandNode on JSONNestedNode.render
1 parent fa35d0a commit e9fed4a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/JSONNestedNode.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ export default class JSONNestedNode extends React.Component {
114114
labelRenderer,
115115
expandable
116116
} = this.props;
117-
const expanded = this.state.expanded;
117+
const expanded = this.props.shouldExpandNode && !this.props.isCircular ?
118+
this.props.shouldExpandNode(this.props.keyPath, this.props.data, this.props.level) : false;
118119
const renderedChildren = expanded || (hideRoot && this.props.level === 0) ?
119120
renderChildNodes({ ...this.props, level: this.props.level + 1 }) : null;
120121

0 commit comments

Comments
 (0)