Merge pull request #907 from influxdata/906-router_history_warning

Fix react-router warning
pull/909/head
Andrew Watkins 2017-02-22 07:31:13 -06:00 committed by GitHub
commit 0ba45a0ed9
2 changed files with 5 additions and 4 deletions

View File

@ -2,6 +2,7 @@
### Bug Fixes ### Bug Fixes
1. [#882](https://github.com/influxdata/chronograf/pull/882): Fix y-axis graph padding 1. [#882](https://github.com/influxdata/chronograf/pull/882): Fix y-axis graph padding
2. [#907](https://github.com/influxdata/chronograf/pull/907): Fix react-router warning
### Features ### Features
1. [#873](https://github.com/influxdata/chronograf/pull/873): Add [TLS](https://github.com/influxdata/chronograf/blob/master/docs/tls.md) support 1. [#873](https://github.com/influxdata/chronograf/pull/873): Add [TLS](https://github.com/influxdata/chronograf/blob/master/docs/tls.md) support

View File

@ -1,8 +1,8 @@
import React from 'react'; import React from 'react';
import {render} from 'react-dom'; import {render} from 'react-dom';
import {Provider} from 'react-redux'; import {Provider} from 'react-redux';
import {Router, Route, Redirect} from 'react-router'; import {Router, Route, Redirect, useRouterHistory} from 'react-router';
import {createHistory, useBasename} from 'history'; import {createHistory} from 'history';
import App from 'src/App'; import App from 'src/App';
import AlertsApp from 'src/alerts'; import AlertsApp from 'src/alerts';
@ -29,11 +29,11 @@ let browserHistory;
const basepath = rootNode.dataset.basepath; const basepath = rootNode.dataset.basepath;
window.basepath = basepath; window.basepath = basepath;
if (basepath) { if (basepath) {
browserHistory = useBasename(createHistory)({ browserHistory = useRouterHistory(createHistory)({
basename: basepath, // this is written in when available by the URL prefixer middleware basename: basepath, // this is written in when available by the URL prefixer middleware
}); });
} else { } else {
browserHistory = useBasename(createHistory)({ browserHistory = useRouterHistory(createHistory)({
basename: "", basename: "",
}); });
} }