[web] bug fix

This commit is contained in:
Jason 2016-08-16 00:27:57 +08:00
parent 900b3d74ba
commit 81b726bab1

View File

@ -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);
}