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
f32a048b
Commit
f32a048b
authored
Apr 02, 2026
by
Zack Tanner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
failing test for prefetchInlining + revalidation
parent
e464ca39
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
0 deletions
+89
-0
route.ts
...-cache/prefetch-inlining/app/api/revalidate-path/route.ts
+13
-0
layout.tsx
...refetch-inlining/app/test-on-demand-revalidate/layout.tsx
+9
-0
page.tsx
.../prefetch-inlining/app/test-on-demand-revalidate/page.tsx
+17
-0
prefetch-inlining.test.ts
...segment-cache/prefetch-inlining/prefetch-inlining.test.ts
+50
-0
No files found.
test/e2e/app-dir/segment-cache/prefetch-inlining/app/api/revalidate-path/route.ts
0 → 100644
View file @
f32a048b
import
{
revalidatePath
}
from
'next/cache'
import
{
NextRequest
,
NextResponse
}
from
'next/server'
export
async
function
GET
(
req
:
NextRequest
)
{
const
path
=
req
.
nextUrl
.
searchParams
.
get
(
'path'
)
||
'/'
try
{
revalidatePath
(
path
)
return
NextResponse
.
json
({
revalidated
:
true
,
path
})
}
catch
{
return
NextResponse
.
json
({
revalidated
:
false
,
path
},
{
status
:
500
})
}
}
test/e2e/app-dir/segment-cache/prefetch-inlining/app/test-on-demand-revalidate/layout.tsx
0 → 100644
View file @
f32a048b
import
{
ReactNode
}
from
'react'
export
default
function
OnDemandRevalidateLayout
({
children
,
}:
{
children
:
ReactNode
})
{
return
<
div
>
{
children
}
</
div
>
}
test/e2e/app-dir/segment-cache/prefetch-inlining/app/test-on-demand-revalidate/page.tsx
0 → 100644
View file @
f32a048b
import
{
cacheLife
}
from
'next/cache'
async
function
CachedValue
()
{
'use cache'
cacheLife
({
stale
:
120
})
return
<
p
id=
"page-on-demand-revalidate-value"
>
{
Math
.
random
()
}
</
p
>
}
export
default
function
OnDemandRevalidatePage
()
{
return
(
<>
<
p
id=
"page-on-demand-revalidate"
>
On-demand revalidate page
</
p
>
<
CachedValue
/>
</>
)
}
test/e2e/app-dir/segment-cache/prefetch-inlining/prefetch-inlining.test.ts
View file @
f32a048b
import
type
*
as
Playwright
from
'playwright'
import
{
nextTestSetup
}
from
'e2e-utils'
import
{
retry
}
from
'next-test-utils'
import
{
createRouterAct
}
from
'router-act'
// Bit values from PrefetchHint enum (const enum, so we duplicate values here)
...
...
@@ -233,6 +234,55 @@ describe('prefetch inlining', () => {
)
})
it
.
failing
(
'preserves prefetch hints after on-demand revalidation'
,
async
()
=>
{
const
beforeTree
=
await
fetchRouteTreePrefetch
(
next
,
'/test-on-demand-revalidate'
)
expect
(
renderInliningTree
(
beforeTree
.
tree
)).
toMatchInlineSnapshot
(
`
"
⇣ root
⇣ └── "test-on-demand-revalidate"
outlined ■ └── "__PAGE__" (+metadata)
"
`
)
const
before$
=
await
next
.
render$
(
'/test-on-demand-revalidate'
)
const
beforeValue
=
before$
(
'#page-on-demand-revalidate-value'
).
text
()
expect
(
beforeValue
).
toMatch
(
/^0
\.\d
+$/
)
const
revalidateRes
=
await
next
.
fetch
(
'/api/revalidate-path?path=/test-on-demand-revalidate'
)
expect
(
revalidateRes
.
status
).
toBe
(
200
)
expect
(
await
revalidateRes
.
json
()).
toEqual
({
revalidated
:
true
,
path
:
'/test-on-demand-revalidate'
,
})
await
retry
(
async
()
=>
{
const
$
=
await
next
.
render$
(
'/test-on-demand-revalidate'
)
const
afterValue
=
$
(
'#page-on-demand-revalidate-value'
).
text
()
expect
(
afterValue
).
toMatch
(
/^0
\.\d
+$/
)
expect
(
afterValue
).
not
.
toBe
(
beforeValue
)
},
15000
,
1000
)
const
afterTree
=
await
fetchRouteTreePrefetch
(
next
,
'/test-on-demand-revalidate'
)
expect
(
renderInliningTree
(
afterTree
.
tree
)).
toBe
(
renderInliningTree
(
beforeTree
.
tree
)
)
}
)
it
(
'parallel routes: parent inlines into one slot only'
,
async
()
=>
{
// Layout with two parallel slots (children + @sidebar), all small. The
// layout can only be inlined into one child — the first slot that
...
...
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