Bug 1328567 - TreeView expandedNodes should update when props changed r?honza
MozReview-Commit-ID: FdJWqTY52eW
--- a/devtools/client/shared/components/tree/tree-view.js
+++ b/devtools/client/shared/components/tree/tree-view.js
@@ -120,16 +120,23 @@ define(function (require, exports, modul
getInitialState: function () {
return {
expandedNodes: this.props.expandedNodes,
columns: ensureDefaultColumn(this.props.columns)
};
},
+ componentWillReceiveProps: function (nextProps) {
+ let { expandedNodes } = nextProps;
+ this.setState(Object.assign({}, this.state, {
+ expandedNodes,
+ }));
+ },
+
// Node expand/collapse
toggle: function (nodePath) {
let nodes = this.state.expandedNodes;
if (this.isExpanded(nodePath)) {
nodes.delete(nodePath);
} else {
nodes.add(nodePath);