Unverified Commit 103e8226 authored by Richard van der Dys's avatar Richard van der Dys Committed by GitHub

Fixed pathname check in router (#10547)

* Fixed pathname check in router

Remove the query portion of the URL when checking paths

* Updated change and added trial test

* Update test
Co-authored-by: 's avatarJJ Kasper <jj@jjsweb.site>
parent 893fb6e9
......@@ -240,8 +240,8 @@ export default class Router implements BaseRouter {
if (
e.state &&
this.isSsr &&
e.state.url === this.pathname &&
e.state.as === this.asPath
e.state.as === this.asPath &&
parse(e.state.url).pathname === this.pathname
) {
return
}
......
......@@ -310,6 +310,23 @@ describe('Production Usage', () => {
expect(newText).toBe('server')
})
it('should navigate to external site and back (with query)', async () => {
const browser = await webdriver(appPort, '/external-and-back?hello=world')
const initialText = await browser.elementByCss('p').text()
expect(initialText).toBe('server')
await browser
.elementByCss('a')
.click()
.waitForElementByCss('input')
.back()
.waitForElementByCss('p')
await waitFor(1000)
const newText = await browser.elementByCss('p').text()
expect(newText).toBe('server')
})
it('should change query correctly', async () => {
const browser = await webdriver(appPort, '/query?id=0')
let id = await browser.elementByCss('#q0').text()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment