File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
content-src/components/Routes Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -4,9 +4,10 @@ const {connect} = require("react-redux");
4
4
const { actions} = require ( "common/action-manager" ) ;
5
5
6
6
// This stuff needs a DOM to work with
7
+ let customHistory ;
7
8
if ( ! PRERENDER ) {
8
9
const { createHashHistory} = require ( "history" ) ;
9
- const history = useRouterHistory ( createHashHistory ) ( { queryKey : false } ) ;
10
+ customHistory = useRouterHistory ( createHashHistory ) ( { queryKey : false } ) ;
10
11
}
11
12
12
13
let isFirstLoad = true ;
@@ -19,16 +20,12 @@ const RouteList = (
19
20
< IndexRoute title = "History" component = { require ( "components/TimelinePage/TimelineHistory" ) } />
20
21
< Route title = "History" path = "bookmarks" component = { require ( "components/TimelinePage/TimelineBookmarks" ) } />
21
22
</ Route >
22
- </ Route >
23
- ) ;
23
+ </ Route >
24
+ ) ;
24
25
25
26
const Routes = React . createClass ( {
26
27
componentDidMount ( ) {
27
- if ( PRERENDER ) {
28
- return ;
29
- }
30
-
31
- this . unlisten = history . listen ( location => {
28
+ this . unlisten = customHistory . listen ( location => {
32
29
this . props . dispatch ( actions . NotifyRouteChange ( Object . assign ( { } , location , { isFirstLoad} ) ) ) ;
33
30
if ( isFirstLoad ) {
34
31
isFirstLoad = false ;
@@ -40,8 +37,12 @@ const Routes = React.createClass({
40
37
this . unlisten ( ) ;
41
38
} ,
42
39
render ( ) {
40
+ let routerProps = { } ;
41
+ if ( ! PRERENDER ) {
42
+ routerProps . history = customHistory ;
43
+ }
43
44
return (
44
- < Router >
45
+ < Router { ... routerProps } >
45
46
{ RouteList }
46
47
</ Router > ) ;
47
48
}
You can’t perform that action at this time.
0 commit comments