1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
next.js/test/integration/basic/pages
tangye ad5431b4ae
should not change method to replaceState unless asPath is the same (#6033)
original code in `/lib/router/router.js`
```
  urlIsNew (pathname, query) {
    return this.pathname !== pathname || !shallowEquals(query, this.query)
  }
```
the urlIsNew compare `this.pathname` to an argument `pathname`
the invokers:
```
    // If asked to change the current URL we should reload the current page
    // (not location.reload() but reload getInitialProps and other Next.js stuffs)
    // We also need to set the method = replaceState always
    // as this should not go into the history (That's how browsers work)
    if (!this.urlIsNew(asPathname, asQuery)) {
      method = 'replaceState'
    }
```
the parameter here is `asPathname` destructured from `asPath`

so here is a problem when we reuse a single page rendered in two asPaths

pages/a.js
```
<>
  <Link href='/a'><a>goto a</a></Link>
  <Link href='/a' as='/b'><a>goto b</a></Link>
</>
```
If we navigate to page /a, then click 'goto b', actually the history is replaced, not pushed.
It is expected that history could be correctly pushed and popped as long as the browser url is changed.
2019-01-11 15:44:25 -06:00
..
dynamic Tests for "ssr: true" on dynamic pages (#5728) 2018-11-25 01:11:25 +01:00
hmr Don’t use chunkhash in development (#4436) 2018-05-23 14:37:02 +02:00
nav should not change method to replaceState unless asPath is the same (#6033) 2019-01-11 15:44:25 -06:00
nested-cdm Fix page loader page normalization issue (#1844) 2017-05-01 16:26:18 -07:00
using-asset Improved next/asset support (#3664) 2018-02-02 21:09:24 +01:00
async-props.js Upgrade standard.js (#4064) 2018-03-27 20:11:03 +02:00
custom-encoding.js Add a charset to the default Content-Type (#3333) 2017-12-05 16:00:58 -08:00
custom-extension.jsx Add custom-server-typescript example (see #3694) (#3838) 2018-02-22 16:29:47 +01:00
default-head.js Remove dublicate className from head (followup) (#5027) 2018-08-25 10:00:57 +02:00
empty-get-initial-props.js Make sure lastAppProps always have some value. (#829) 2017-01-20 11:33:46 -08:00
error-in-the-browser-global-scope.js Remove unused vars and fix typo. (#5752) 2018-11-27 12:28:34 +01:00
error-in-the-global-scope.js Fix SSR error handling in the global scope (#3877) 2018-02-24 18:49:08 +05:30
error-inside-browser-page.js Remove unused vars and fix typo. (#5752) 2018-11-27 12:28:34 +01:00
error-inside-page.js Fix SSR error handling in the global scope (#3877) 2018-02-24 18:49:08 +05:30
exports.js Fix edge case where file had module.export in the content (#5823) 2018-12-05 14:37:26 +01:00
forwardRef-component.js Change page export validity check on client and server in development (#5857) 2018-12-17 16:09:23 +01:00
fragment-syntax.js Upgrade Babel 6 to Babel 7 (major) (#4050) 2018-04-03 09:34:07 +02:00
head.js Dedupe only items with unique key (#5800) 2018-12-03 17:28:42 +01:00
index.js Fix the page-loader-normalization issue on '/index' page. (#1882) 2017-05-04 13:05:47 -07:00
instance-get-initial-props.js Add test for instance method on getInitialProps. (#5951) 2018-12-26 23:30:16 +01:00
json.js Fix .json import issue (#944) 2017-02-01 15:17:15 +09:00
link.js Updated <Link> in repo, always wrapping an anchor. (#798) 2017-01-16 22:27:55 +01:00
memo-component.js Change page export validity check on client and server in development (#5857) 2018-12-17 16:09:23 +01:00
no-default-export.js Handle pages with no default export and show an error. (#1484) 2017-03-23 09:40:22 +05:30
process-env.js Remove obsolete webpack plugins (#5158) 2018-09-14 15:45:48 +02:00
read-only-object-error.js Transpile imports if module has module.exports (#5780) 2018-11-30 17:56:07 +01:00
stateless.js New test setup (#640) 2017-01-12 13:14:49 +09:00
styled-jsx.js New test setup (#640) 2017-01-12 13:14:49 +09:00
url-prop-override.js Fix url prop override (#4191) 2018-04-22 13:20:24 -07:00
url-prop.js Fix url prop override (#4191) 2018-04-22 13:20:24 -07:00
with-cdm.js Fix page loader page normalization issue (#1844) 2017-05-01 16:26:18 -07:00