From 81b726bab1cc403977ef4aea060f88ab8a0a66fd Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 16 Aug 2016 00:27:57 +0800 Subject: [PATCH] [web] bug fix --- web/src/js/components/ProxyApp.jsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/web/src/js/components/ProxyApp.jsx b/web/src/js/components/ProxyApp.jsx index 5b0070c9f..d76816e56 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); }