Merge pull request #1015 from gzzhanghao/props

[web] dont mutate props
This commit is contained in:
Maximilian Hils 2016-03-09 18:53:05 +01:00
commit 454cca43f0
2 changed files with 6 additions and 4 deletions

View file

@ -999,8 +999,9 @@ var EventLogContents = _react2.default.createClass({
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
if (nextProps.filter !== this.props.filter) {
this.props.filter = nextProps.filter; // Dirty: Make sure that view filter sees the update.
this.state.view.recalculate();
this.state.view.recalculate(function (entry) {
return nextProps.filter[entry.level];
});
}
},
getDefaultProps: function getDefaultProps() {

View file

@ -58,8 +58,9 @@ var EventLogContents = React.createClass({
},
componentWillReceiveProps: function (nextProps) {
if (nextProps.filter !== this.props.filter) {
this.props.filter = nextProps.filter; // Dirty: Make sure that view filter sees the update.
this.state.view.recalculate();
this.state.view.recalculate(entry =>
nextProps.filter[entry.level]
);
}
},
getDefaultProps: function () {