diff options
author | Maximilian Hils <git@maximilianhils.com> | 2015-03-27 16:54:21 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2015-03-27 16:54:21 +0100 |
commit | dcb42b3016415865848cdc2607ff640c1fd50818 (patch) | |
tree | 9f44661c98efa22d69964bdb9988187fbed53e33 | |
parent | 11b082c99810e5fb2cce78c99a850b0aa8558609 (diff) | |
download | mitmproxy-dcb42b3016415865848cdc2607ff640c1fd50818.tar.gz mitmproxy-dcb42b3016415865848cdc2607ff640c1fd50818.tar.bz2 mitmproxy-dcb42b3016415865848cdc2607ff640c1fd50818.zip |
web: fix react-router
-rw-r--r-- | libmproxy/web/static/app.js | 6 | ||||
-rw-r--r-- | web/src/js/components/common.js | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/libmproxy/web/static/app.js b/libmproxy/web/static/app.js index 044b9e35..24f4948e 100644 --- a/libmproxy/web/static/app.js +++ b/libmproxy/web/static/app.js @@ -528,10 +528,12 @@ var Navigation = _.extend({}, ReactRouter.Navigation, { // we may remove this mixin and access react-router directly again. var State = _.extend({}, ReactRouter.State, { getQuery: function(){ - return this.context.router.getCurrentQuery(); + // For whatever reason, react-router always returns the same object, which makes comparing + // the current props with nextProps impossible. As a workaround, we just clone the query object. + return _.clone(this.context.router.getCurrentQuery()); }, getParams: function(){ - return this.context.router.getCurrentParams(); + return _.clone(this.context.router.getCurrentParams()); } }); diff --git a/web/src/js/components/common.js b/web/src/js/components/common.js index ba4c93c2..433e4f10 100644 --- a/web/src/js/components/common.js +++ b/web/src/js/components/common.js @@ -67,10 +67,12 @@ var Navigation = _.extend({}, ReactRouter.Navigation, { // we may remove this mixin and access react-router directly again. var State = _.extend({}, ReactRouter.State, { getQuery: function(){ - return this.context.router.getCurrentQuery(); + // For whatever reason, react-router always returns the same object, which makes comparing + // the current props with nextProps impossible. As a workaround, we just clone the query object. + return _.clone(this.context.router.getCurrentQuery()); }, getParams: function(){ - return this.context.router.getCurrentParams(); + return _.clone(this.context.router.getCurrentParams()); } }); |