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
721eb615
Unverified
Commit
721eb615
authored
Oct 27, 2025
by
Sebastian "Sebbie" Silbermann
Committed by
GitHub
Oct 27, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[test] Speed up prefetching suite (#85417)
parent
6ea6270e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
30 deletions
+15
-30
page.js
test/e2e/app-dir/app-prefetch/app/dashboard/[id]/page.js
+1
-2
layout.js
test/e2e/app-dir/app-prefetch/app/layout.js
+0
-1
layout.tsx
...ir/app-prefetch/app/prefetch-auto-route-groups/layout.tsx
+8
-14
layout.js
...e/app-dir/app-prefetch/app/prefetch-auto/[slug]/layout.js
+1
-6
page.js
...e2e/app-dir/app-prefetch/app/prefetch-auto/[slug]/page.js
+1
-1
prefetching.test.ts
test/e2e/app-dir/app-prefetch/prefetching.test.ts
+4
-6
No files found.
test/e2e/app-dir/app-prefetch/app/dashboard/[id]/page.js
View file @
721eb615
...
@@ -14,8 +14,7 @@ export function generateStaticParams() {
...
@@ -14,8 +14,7 @@ export function generateStaticParams() {
export
default
function
IdPage
(
props
)
{
export
default
function
IdPage
(
props
)
{
const
params
=
use
(
props
.
params
)
const
params
=
use
(
props
.
params
)
const
data
=
use
(
getData
())
use
(
getData
())
console
.
log
(
data
)
if
(
params
.
id
===
'123'
)
{
if
(
params
.
id
===
'123'
)
{
return
(
return
(
...
...
test/e2e/app-dir/app-prefetch/app/layout.js
View file @
721eb615
...
@@ -2,7 +2,6 @@ export default function Root({ children }) {
...
@@ -2,7 +2,6 @@ export default function Root({ children }) {
return
(
return
(
<
html
>
<
html
>
<
head
>
<
head
>
<
script
src
=
"https://cdn.tailwindcss.com?plugins=typography"
><
/script
>
<
title
>
Hello
World
<
/title
>
<
title
>
Hello
World
<
/title
>
<
script
<
script
dangerouslySetInnerHTML
=
{{
dangerouslySetInnerHTML
=
{{
...
...
test/e2e/app-dir/app-prefetch/app/prefetch-auto-route-groups/layout.tsx
View file @
721eb615
...
@@ -5,22 +5,16 @@ import Link from 'next/link'
...
@@ -5,22 +5,16 @@ import Link from 'next/link'
export
default
function
Layout
({
children
}:
{
children
:
React
.
ReactNode
})
{
export
default
function
Layout
({
children
}:
{
children
:
React
.
ReactNode
})
{
return
(
return
(
<>
<>
<
nav
className=
"bg-gray-800"
>
<
nav
style=
{
{
border
:
'1px solid #1f2937'
}
}
>
<
ul
className=
"flex"
>
<
ul
style=
{
{
display
:
'flex'
}
}
>
<
li
className=
"mr-6"
>
<
li
style=
{
{
marginRight
:
'1.5rem'
}
}
>
<
Link
href=
"/prefetch-auto-route-groups"
>
<
Link
href=
"/prefetch-auto-route-groups"
>
Dashboard
</
Link
>
<
p
className=
"text-white hover:text-gray-300"
>
Dashboard
</
p
>
</
Link
>
</
li
>
</
li
>
<
li
className=
"mr-6"
>
<
li
style=
{
{
marginRight
:
'1.5rem'
}
}
>
<
Link
href=
"/prefetch-auto-route-groups/sub/foo"
>
<
Link
href=
"/prefetch-auto-route-groups/sub/foo"
>
Foo
</
Link
>
<
p
className=
"text-white hover:text-gray-300"
>
Foo
</
p
>
</
Link
>
</
li
>
</
li
>
<
li
className=
"mr-6"
>
<
li
style=
{
{
marginRight
:
'1.5rem'
}
}
>
<
Link
href=
"/prefetch-auto-route-groups/sub/bar"
>
<
Link
href=
"/prefetch-auto-route-groups/sub/bar"
>
Bar
</
Link
>
<
p
className=
"text-white hover:text-gray-300"
>
Bar
</
p
>
</
Link
>
</
li
>
</
li
>
</
ul
>
</
ul
>
</
nav
>
</
nav
>
...
...
test/e2e/app-dir/app-prefetch/app/prefetch-auto/[slug]/layout.js
View file @
721eb615
import
Link
from
'next/link'
export
const
dynamic
=
'force-dynamic'
export
const
dynamic
=
'force-dynamic'
function
getData
()
{
function
getData
()
{
const
res
=
new
Promise
((
resolve
)
=>
{
const
res
=
new
Promise
((
resolve
)
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
resolve
({
message
:
'Layout Data!'
})
resolve
({
message
:
'Layout Data!'
})
},
2
000
)
},
1
000
)
})
})
return
res
return
res
}
}
...
@@ -17,9 +15,6 @@ export default async function Layout({ children }) {
...
@@ -17,9 +15,6 @@ export default async function Layout({ children }) {
return
(
return
(
<
div
>
<
div
>
<
h1
>
Layout
<
/h1
>
<
h1
>
Layout
<
/h1
>
<
Link
prefetch
=
{
undefined
}
href
=
"/prefetch-auto/justputit"
>
Prefetch
Link
<
/Link
>
{
children
}
{
children
}
<
h3
>
{
JSON
.
stringify
(
result
)}
<
/h3
>
<
h3
>
{
JSON
.
stringify
(
result
)}
<
/h3
>
<
/div
>
<
/div
>
...
...
test/e2e/app-dir/app-prefetch/app/prefetch-auto/[slug]/page.js
View file @
721eb615
...
@@ -4,7 +4,7 @@ function getData() {
...
@@ -4,7 +4,7 @@ function getData() {
const
res
=
new
Promise
((
resolve
)
=>
{
const
res
=
new
Promise
((
resolve
)
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
resolve
({
message
:
'Page Data!'
})
resolve
({
message
:
'Page Data!'
})
},
2
000
)
},
1
000
)
})
})
return
res
return
res
}
}
...
...
test/e2e/app-dir/app-prefetch/prefetching.test.ts
View file @
721eb615
...
@@ -314,22 +314,20 @@ describe('app dir - prefetching', () => {
...
@@ -314,22 +314,20 @@ describe('app dir - prefetching', () => {
async
()
=>
{
async
()
=>
{
const
reveal
=
await
browser
.
elementByCss
(
'#accordion-to-dynamic-page'
)
const
reveal
=
await
browser
.
elementByCss
(
'#accordion-to-dynamic-page'
)
await
reveal
.
click
()
await
reveal
.
click
()
await
browser
.
waitForElementByCss
(
'#to-dynamic-page'
)
return
browser
.
elementByCss
(
'#to-dynamic-page'
)
return
await
browser
.
elementByCss
(
'#to-dynamic-page'
)
},
},
{
includes
:
'Loading Prefetch Auto'
}
{
includes
:
'Loading Prefetch Auto'
}
)
)
// Click the link to navigate - should trigger dynamic data fetch
// Click the link to navigate - should trigger dynamic data fetch
await
act
(
const
loadingText
=
await
act
(
async
()
=>
{
async
()
=>
{
await
link
.
click
()
await
link
.
click
()
await
browser
.
waitForElementByCss
(
'#loading-text'
)
return
browser
.
elementByCss
(
'#loading-text'
).
text
()
const
loadingText
=
await
browser
.
elementByCss
(
'#loading-text'
).
text
()
expect
(
loadingText
).
toBe
(
'Loading Prefetch Auto'
)
},
},
{
includes
:
'prefetch-auto-page-data'
}
{
includes
:
'prefetch-auto-page-data'
}
)
)
expect
(
loadingText
).
toBe
(
'Loading Prefetch Auto'
)
// Wait for final data to appear
// Wait for final data to appear
await
browser
.
waitForElementByCss
(
'#prefetch-auto-page-data'
)
await
browser
.
waitForElementByCss
(
'#prefetch-auto-page-data'
)
...
...
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