File tree 3 files changed +7
-2
lines changed
3 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 68
68
"lru-memoize" : " 0.0.2" ,
69
69
"piping" : " 0.2.0" ,
70
70
"pretty-error" : " ^1.1.2" ,
71
+ "query-string" : " ^2.4.0" ,
71
72
"react" : " 0.13.3" ,
72
73
"react-document-meta" : " ^0.1.4" ,
73
74
"react-inline-css" : " 1.2.1" ,
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import 'babel/polyfill';
3
3
import React from 'react' ;
4
4
import BrowserHistory from 'react-router/lib/BrowserHistory' ;
5
5
import Location from 'react-router/lib/Location' ;
6
+ import queryString from 'query-string' ;
6
7
import createStore from './redux/create' ;
7
8
import ApiClient from './ApiClient' ;
8
9
import universalRouter from './universalRouter' ;
@@ -11,7 +12,9 @@ const client = new ApiClient();
11
12
12
13
const dest = document . getElementById ( 'content' ) ;
13
14
const store = createStore ( client , window . __data ) ;
14
- const location = new Location ( document . location . pathname , document . location . search ) ;
15
+ const search = document . location . search ;
16
+ const query = search && queryString . parse ( search ) ;
17
+ const location = new Location ( document . location . pathname , query ) ;
15
18
universalRouter ( location , history , store )
16
19
. then ( ( { component} ) => {
17
20
if ( __DEVTOOLS__ ) {
Original file line number Diff line number Diff line change @@ -11,11 +11,12 @@ const getFetchData = (component = {}) => {
11
11
12
12
export function createTransitionHook ( store ) {
13
13
return ( nextState , transition , callback ) => {
14
+ const { params, location : { query } } = nextState ;
14
15
const promises = nextState . branch
15
16
. map ( route => route . component ) // pull out individual route components
16
17
. filter ( ( component ) => getFetchData ( component ) ) // only look at ones with a static fetchData()
17
18
. map ( getFetchData ) // pull out fetch data methods
18
- . map ( fetchData => fetchData ( store , nextState . params ) ) ; // call fetch data methods and save promises
19
+ . map ( fetchData => fetchData ( store , params , query || { } ) ) ; // call fetch data methods and save promises
19
20
Promise . all ( promises )
20
21
. then ( ( ) => {
21
22
callback ( ) ; // can't just pass callback to then() because callback assumes first param is error
You can’t perform that action at this time.
0 commit comments