File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
website/src/components/playground Expand file tree Collapse file tree 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) {
1212 } ,
1313 { } ,
1414 )
15- return qs . stringify ( lightState , { arrayFormat : 'bracket' } )
15+ const qsStr = qs . stringify ( lightState , { arrayFormat : 'bracket' } )
16+ return qsStr ? `?${ qsStr } ` : ''
1617}
1718
1819function parseQuery ( query ) {
1920 return qs . parse ( query , { arrayFormat : 'bracket' , parseBooleans : true } )
2021}
2122
2223function 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 }
2527}
2628
2729let browserHistory
@@ -47,7 +49,7 @@ function useLocation() {
4749export function useQuery ( getInitialState = { } ) {
4850 const history = useHistory ( )
4951 const [ initialState ] = React . useState ( getInitialState )
50- const location = useLocation ( )
52+ const { location } = useLocation ( )
5153 const locationRef = React . useRef ( location )
5254 React . useEffect ( ( ) => {
5355 locationRef . current = location
You can’t perform that action at this time.
0 commit comments