aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason <jason.daurus@gmail.com>2016-08-16 00:27:57 +0800
committerJason <jason.daurus@gmail.com>2016-08-16 00:27:57 +0800
commit81b726bab1cc403977ef4aea060f88ab8a0a66fd (patch)
tree922e0f1cea23b1bc69f923c5ff58921eb01554ae
parent900b3d74ba27ece145237896fe9adac332cf9201 (diff)
downloadmitmproxy-81b726bab1cc403977ef4aea060f88ab8a0a66fd.tar.gz
mitmproxy-81b726bab1cc403977ef4aea060f88ab8a0a66fd.tar.bz2
mitmproxy-81b726bab1cc403977ef4aea060f88ab8a0a66fd.zip
[web] bug fix
-rw-r--r--web/src/js/components/ProxyApp.jsx11
1 files changed, 6 insertions, 5 deletions
diff --git a/web/src/js/components/ProxyApp.jsx b/web/src/js/components/ProxyApp.jsx
index 5b0070c9..d76816e5 100644
--- a/web/src/js/components/ProxyApp.jsx
+++ b/web/src/js/components/ProxyApp.jsx
@@ -1,6 +1,6 @@
import React, { Component, PropTypes } from 'react'
import { connect } from 'react-redux'
-import { createHashHistory } from 'history'
+import { createHashHistory, useQueries } from 'history'
import { init as appInit, destruct as appDestruct } from '../ducks/app'
import { onKeyDown } from '../ducks/ui/keyboard'
@@ -16,7 +16,8 @@ import Footer from './Footer'
class ProxyAppMain extends Component {
flushToStore(location) {
- const components = location.pathname.split('/')
+ const components = location.pathname.split('/').filter(v => v)
+ const query = location.query || {}
if (components.length > 2) {
this.props.selectFlow(components[1])
@@ -26,8 +27,8 @@ class ProxyAppMain extends Component {
this.props.selectTab(null)
}
- this.props.updateFilter(location.query[Query.SEARCH])
- this.props.updateHighlight(location.query[Query.HIGHLIGHT])
+ this.props.updateFilter(query[Query.SEARCH])
+ this.props.updateHighlight(query[Query.HIGHLIGHT])
}
flushToHistory(props) {
@@ -50,7 +51,7 @@ class ProxyAppMain extends Component {
componentWillMount() {
this.props.appInit()
- this.history = createHashHistory()
+ this.history = useQueries(createHashHistory)()
this.unlisten = this.history.listen(location => this.flushToStore(location))
window.addEventListener('keydown', this.props.onKeyDown);
}