@@ -40,34 +40,27 @@ const RouteStore = t
40
40
// /racket/jobs ..
41
41
42
42
markRoute ( query ) {
43
- if ( ! onClient || R . isEmpty ( query ) ) return false
43
+ if ( ! onClient ) return false
44
44
const { mainPath, subPath, page } = query
45
+ query = R . pickBy ( v => ! R . isEmpty ( v ) , query )
45
46
46
- if ( mainPath ) {
47
- self . mainPath = mainPath
48
- }
49
- if ( subPath ) {
50
- self . subPath = subPath
51
- }
47
+ if ( mainPath ) self . mainPath = mainPath
48
+ if ( subPath ) self . subPath = subPath
52
49
53
- if ( page && String ( page ) === '1' ) {
54
- query = R . omit ( [ 'page' ] , query )
55
- }
50
+ if ( page && String ( page ) === '1' ) query = R . omit ( [ 'page' ] , query )
56
51
57
52
const allQueryString = serializeQuery ( query )
58
53
const queryString = serializeQuery ( R . omit ( [ 'mainPath' , 'subPath' ] , query ) )
59
54
60
55
const url = `/${ allQueryString } `
61
- let asPath = `/${ self . mainPath } /${ self . subPath } ${ queryString } `
62
- if ( self . subPath === 'index' || self . mainPath === self . subPath ) {
63
- asPath = `/${ self . mainPath } ${ queryString } `
64
- }
56
+ const asPath = `/${ self . mainPath } /${ self . subPath } ${ queryString } `
65
57
66
58
// NOTE: shallow option only works for same page url
67
59
// if page is diffrent, it will cause page reload
68
- Router . push ( url , asPath , {
69
- shallow : true ,
70
- } )
60
+ /* console.log('push url: ', url) */
61
+ Router . push ( url , asPath , { shallow : true } )
62
+ // see: https://stackoverflow.com/questions/824349/modify-the-url-without-reloading-the-page
63
+ /* return Global.history.pushState({}, null, url) */
71
64
} ,
72
65
markState ( sobj ) {
73
66
markStates ( sobj , self )
0 commit comments