From 84f180847d0e63dd6e12a82cebaf7fe4ffad040d Mon Sep 17 00:00:00 2001 From: Jason Date: Wed, 9 Mar 2016 13:30:46 +0800 Subject: [web] dont mutate props --- mitmproxy/web/static/app.js | 5 +++-- 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 () { -- cgit v1.2.3