Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed pathname check in router #10547

Merged
merged 6 commits into from Feb 19, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/next/next-server/lib/router/router.ts
Expand Up @@ -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
}
Expand Down
17 changes: 17 additions & 0 deletions test/integration/production/test/index.test.js
Expand Up @@ -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()
Expand Down