|
5 | 5 |
|
6 | 6 | import { types as t, getParent } from 'mobx-state-tree'
|
7 | 7 | import R from 'ramda'
|
8 |
| -import Router from 'next/router' |
| 8 | +// import Router from 'next/router' |
9 | 9 |
|
10 | 10 | import { PAGE_SIZE } from '@config'
|
11 |
| -import { onClient, markStates, buildLog, serializeQuery } from '@utils' |
| 11 | +import { Global, onClient, markStates, buildLog, serializeQuery } from '@utils' |
12 | 12 |
|
13 | 13 | /* eslint-disable-next-line */
|
14 | 14 | const log = buildLog('S:RouteStore')
|
@@ -47,18 +47,20 @@ const RouteStore = t
|
47 | 47 |
|
48 | 48 | if (page && String(page) === '1') query = R.omit(['page'], query)
|
49 | 49 |
|
50 |
| - const allQueryString = serializeQuery(query) |
| 50 | + // const allQueryString = serializeQuery(query) |
51 | 51 | const queryString = serializeQuery(R.omit(['mainPath', 'subPath'], query))
|
52 | 52 |
|
53 |
| - const url = `/${allQueryString}` |
| 53 | + // const url = `/${allQueryString}` |
54 | 54 | const asPath = `/${self.mainPath}/${self.subPath}${queryString}`
|
55 | 55 |
|
56 | 56 | // NOTE: shallow option only works for same page url
|
57 | 57 | // if page is diffrent, it will cause page reload
|
58 | 58 | /* console.log('push url: ', url) */
|
59 |
| - Router.push(url, asPath, { shallow: true }) |
| 59 | + // Router.push(url, asPath, { shallow: true }) |
60 | 60 | // see: https://stackoverflow.com/questions/824349/modify-the-url-without-reloading-the-page
|
61 | 61 | /* return Global.history.pushState({}, null, url) */
|
| 62 | + // NOTE: Router.push(url, asPath, { shallow: true }) is not working on pruction env |
| 63 | + return Global.history.pushState({}, null, asPath) |
62 | 64 | },
|
63 | 65 | markState(sobj) {
|
64 | 66 | markStates(sobj, self)
|
|
0 commit comments