File tree 1 file changed +6
-4
lines changed
website/src/components/playground
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -12,16 +12,18 @@ function formatQuery(state, initialState) {
12
12
} ,
13
13
{ } ,
14
14
)
15
- return qs . stringify ( lightState , { arrayFormat : 'bracket' } )
15
+ const qsStr = qs . stringify ( lightState , { arrayFormat : 'bracket' } )
16
+ return qsStr ? `?${ qsStr } ` : ''
16
17
}
17
18
18
19
function parseQuery ( query ) {
19
20
return qs . parse ( query , { arrayFormat : 'bracket' , parseBooleans : true } )
20
21
}
21
22
22
23
function getLocation ( ) {
23
- if ( typeof window === 'undefined' ) return { search : '' , pathname : '' }
24
- return window . location
24
+ if ( typeof window === 'undefined' )
25
+ return { location : { search : '' , pathname : '' } }
26
+ return { location : window . location }
25
27
}
26
28
27
29
let browserHistory
@@ -47,7 +49,7 @@ function useLocation() {
47
49
export function useQuery ( getInitialState = { } ) {
48
50
const history = useHistory ( )
49
51
const [ initialState ] = React . useState ( getInitialState )
50
- const location = useLocation ( )
52
+ const { location } = useLocation ( )
51
53
const locationRef = React . useRef ( location )
52
54
React . useEffect ( ( ) => {
53
55
locationRef . current = location
You can’t perform that action at this time.
0 commit comments