Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
a72e136c
Unverified
Commit
a72e136c
authored
Jun 28, 2022
by
JJ Kasper
Committed by
GitHub
Jun 28, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure history navigation is correct after query update (#38086)
parent
edf4ea39
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
0 deletions
+39
-0
router.ts
packages/next/shared/lib/router/router.ts
+2
-0
index.test.ts
test/e2e/middleware-rewrites/test/index.test.ts
+17
-0
index.test.js
test/integration/production/test/index.test.js
+20
-0
No files found.
packages/next/shared/lib/router/router.ts
View file @
a72e136c
...
...
@@ -903,6 +903,8 @@ export default class Router implements BaseRouter {
Object
.
assign
<
{},
TransitionOptions
,
TransitionOptions
>
({},
options
,
{
shallow
:
options
.
shallow
&&
this
.
_shallow
,
locale
:
options
.
locale
||
this
.
defaultLocale
,
// @ts-ignore internal value not exposed on types
_h
:
0
,
}),
forcedScroll
)
...
...
test/e2e/middleware-rewrites/test/index.test.ts
View file @
a72e136c
...
...
@@ -50,6 +50,23 @@ describe('Middleware Rewrite', () => {
},
/Welcome Page A/
)
})
it
(
'should rewrite correctly when navigating via history after query update'
,
async
()
=>
{
const
browser
=
await
webdriver
(
next
.
url
,
'/'
)
await
browser
.
elementByCss
(
'#override-with-internal-rewrite'
).
click
()
await
check
(()
=>
{
return
browser
.
eval
(
'document.documentElement.innerHTML'
)
},
/Welcome Page A/
)
await
browser
.
refresh
()
await
browser
.
waitForCondition
(
`!!window.next.router.isReady`
)
await
browser
.
back
()
await
browser
.
waitForElementByCss
(
'#override-with-internal-rewrite'
)
await
browser
.
forward
()
await
check
(()
=>
{
return
browser
.
eval
(
'document.documentElement.innerHTML'
)
},
/Welcome Page A/
)
})
it
(
'should return HTML/data correctly for pre-rendered page'
,
async
()
=>
{
for
(
const
slug
of
[
'first'
,
...
...
test/integration/production/test/index.test.js
View file @
a72e136c
...
...
@@ -68,6 +68,26 @@ describe('Production Usage', () => {
await
killApp
(
app
)
})
it
(
'should navigate through history after query update'
,
async
()
=>
{
const
browser
=
await
webdriver
(
appPort
,
'/'
)
await
browser
.
eval
(
'window.next.router.push("/about?a=b")'
)
await
browser
.
waitForElementByCss
(
'.about-page'
)
await
browser
.
waitForCondition
(
`!!window.next.router.isReady`
)
await
browser
.
refresh
()
await
browser
.
waitForCondition
(
`!!window.next.router.isReady`
)
await
browser
.
back
()
await
browser
.
waitForElementByCss
(
'.index-page'
)
await
browser
.
forward
()
await
browser
.
waitForElementByCss
(
'.about-page'
)
await
browser
.
back
()
await
browser
.
waitForElementByCss
(
'.index-page'
)
await
browser
.
refresh
()
await
browser
.
waitForCondition
(
`!!window.next.router.isReady`
)
await
browser
.
forward
()
await
browser
.
waitForElementByCss
(
'.about-page'
)
})
it
(
'should not show target deprecation warning'
,
()
=>
{
expect
(
output
).
not
.
toContain
(
'The `target` config is deprecated and will be removed in a future version'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment