Skip to content

Commit

Permalink
Fix #94 browser back button not working
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Farro <joef@uber.com>
  • Loading branch information
tiffon committed Oct 27, 2017
1 parent 79d262d commit cfc27ac
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/components/App/Page.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import * as React from 'react';
import Helmet from 'react-helmet';
import { connect } from 'react-redux';
import type { Location } from 'react-router-dom';
import { withRouter } from 'react-router-dom';

import TopNav from './TopNav';
import type { Config } from '../../types/config';
Expand Down Expand Up @@ -64,8 +65,8 @@ class Page extends React.Component<PageProps> {

function mapStateToProps(state, ownProps) {
const { config } = state;
const { location } = state.routing;
const { location } = state.router;
return { ...ownProps, config, location };
}

export default connect(mapStateToProps)(Page);
export default withRouter(connect(mapStateToProps)(Page));
2 changes: 1 addition & 1 deletion src/components/SearchTracePage/TraceSearchForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ const mapStateToProps = state => {
minDuration,
lookback,
traceID: traceIDParams,
} = queryString.parse(state.routing.location.search);
} = queryString.parse(state.router.location.search);

const nowInMicroseconds = moment().valueOf() * 1000;
const today = formatDate(nowInMicroseconds);
Expand Down
2 changes: 1 addition & 1 deletion src/components/SearchTracePage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ const stateServicesXformer = getLastXformCacher(stateServices => {
});

function mapStateToProps(state) {
const query = queryString.parse(state.routing.location.search);
const query = queryString.parse(state.router.location.search);
const isHomepage = !Object.keys(query).length;
const { traces, maxDuration, loading, traceError } = stateTraceXformer(state.trace);
const { services, serviceError } = stateServicesXformer(state.services);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/configure-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function configureStore(history) {
combineReducers({
...jaegerReducers,
traceTimeline: traceTimelineViewReducer,
routing: routerReducer,
router: routerReducer,
}),
compose(
applyMiddleware(
Expand Down
2 changes: 1 addition & 1 deletion src/utils/configure-store.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ it('configureStore() should return the redux store', () => {
expect(typeof store.subscribe === 'function').toBeTruthy();
expect(typeof store.replaceReducer === 'function').toBeTruthy();

expect({}.hasOwnProperty.call(store.getState(), 'routing')).toBeTruthy();
expect({}.hasOwnProperty.call(store.getState(), 'router')).toBeTruthy();
expect({}.hasOwnProperty.call(store.getState(), 'trace')).toBeTruthy();
expect({}.hasOwnProperty.call(store.getState(), 'form')).toBeTruthy();
});

0 comments on commit cfc27ac

Please sign in to comment.