Fix SSG data request failing with trailing slash (#10140)
* Fix SSG data request failing with trailing slash * Update to re-use toRoute method
This commit is contained in:
parent
ee0761255a
commit
51420c7241
3 changed files with 4 additions and 2 deletions
|
@ -666,7 +666,7 @@ export default class Router implements BaseRouter {
|
|||
|
||||
_getStaticData = (asPath: string, _cachedData?: object): Promise<object> => {
|
||||
let pathname = parse(asPath).pathname
|
||||
pathname = !pathname || pathname === '/' ? '/index' : pathname
|
||||
pathname = toRoute(!pathname || pathname === '/' ? '/index' : pathname)
|
||||
|
||||
return process.env.NODE_ENV === 'production' &&
|
||||
(_cachedData = this.sdc[pathname])
|
||||
|
|
|
@ -14,7 +14,7 @@ const Page = ({ world, time }) => {
|
|||
<>
|
||||
<p>hello {world}</p>
|
||||
<span>time: {time}</span>
|
||||
<Link href="/another">
|
||||
<Link href="/another?hello=world" as="/another/?hello=world">
|
||||
<a id="another">to another</a>
|
||||
</Link>
|
||||
<br />
|
||||
|
|
|
@ -134,9 +134,11 @@ const navigateTest = (dev = false) => {
|
|||
|
||||
// go to /another
|
||||
async function goFromHomeToAnother() {
|
||||
await browser.eval('window.beforeAnother = true')
|
||||
await browser.elementByCss('#another').click()
|
||||
await browser.waitForElementByCss('#home')
|
||||
text = await browser.elementByCss('p').text()
|
||||
expect(await browser.eval('window.beforeAnother')).toBe(true)
|
||||
expect(text).toMatch(/hello.*?world/)
|
||||
}
|
||||
await goFromHomeToAnother()
|
||||
|
|
Loading…
Reference in a new issue