diff options
author | Jason <jason.daurus@gmail.com> | 2016-03-09 13:30:46 +0800 |
---|---|---|
committer | Jason <jason.daurus@gmail.com> | 2016-03-09 13:30:55 +0800 |
commit | 84f180847d0e63dd6e12a82cebaf7fe4ffad040d (patch) | |
tree | b232c54c16a68e60ca3eb5ed218bb8938cce76c7 | |
parent | 7fa95aabbbbcc7185f6d8a80652e499142812b93 (diff) | |
download | mitmproxy-84f180847d0e63dd6e12a82cebaf7fe4ffad040d.tar.gz mitmproxy-84f180847d0e63dd6e12a82cebaf7fe4ffad040d.tar.bz2 mitmproxy-84f180847d0e63dd6e12a82cebaf7fe4ffad040d.zip |
[web] dont mutate props
-rw-r--r-- | mitmproxy/web/static/app.js | 5 | ||||
-rw-r--r-- | web/src/js/components/eventlog.js | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/mitmproxy/web/static/app.js b/mitmproxy/web/static/app.js index bb06970e..b939da74 100644 --- a/mitmproxy/web/static/app.js +++ b/mitmproxy/web/static/app.js @@ -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() { diff --git a/web/src/js/components/eventlog.js b/web/src/js/components/eventlog.js index 650f7cd3..51f1578e 100644 --- a/web/src/js/components/eventlog.js +++ b/web/src/js/components/eventlog.js @@ -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 () { |