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
5230c3a9
Commit
5230c3a9
authored
Mar 04, 2026
by
Janka Uryga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add failing tests
parent
cb44b43c
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
292 additions
and
0 deletions
+292
-0
layout.tsx
...ache-components-postpone-in-client/app/(index)/layout.tsx
+7
-0
page.tsx
.../cache-components-postpone-in-client/app/(index)/page.tsx
+49
-0
layout.tsx
...omponents-postpone-in-client/app/instant-false/layout.tsx
+16
-0
client.tsx
...-in-client/app/instant-false/use-params/[slug]/client.tsx
+7
-0
page.tsx
...ne-in-client/app/instant-false/use-params/[slug]/page.tsx
+10
-0
client.tsx
...-in-client/app/instant-false/use-search-params/client.tsx
+7
-0
page.tsx
...ne-in-client/app/instant-false/use-search-params/page.tsx
+10
-0
layout.tsx
...nts-postpone-in-client/app/suspense-above-body/layout.tsx
+15
-0
client.tsx
...ient/app/suspense-above-body/use-params/[slug]/client.tsx
+7
-0
page.tsx
...client/app/suspense-above-body/use-params/[slug]/page.tsx
+10
-0
client.tsx
...ient/app/suspense-above-body/use-search-params/client.tsx
+7
-0
page.tsx
...client/app/suspense-above-body/use-search-params/page.tsx
+10
-0
layout.tsx
...ts-postpone-in-client/app/suspense-inside-body/layout.tsx
+13
-0
client.tsx
...ent/app/suspense-inside-body/use-params/[slug]/client.tsx
+7
-0
page.tsx
...lient/app/suspense-inside-body/use-params/[slug]/page.tsx
+10
-0
client.tsx
...ent/app/suspense-inside-body/use-search-params/client.tsx
+7
-0
page.tsx
...lient/app/suspense-inside-body/use-search-params/page.tsx
+10
-0
cache-components-postpone-in-client.test.ts
...one-in-client/cache-components-postpone-in-client.test.ts
+76
-0
next.config.ts
...pp-dir/cache-components-postpone-in-client/next.config.ts
+14
-0
No files found.
test/e2e/app-dir/cache-components-postpone-in-client/app/(index)/layout.tsx
0 → 100644
View file @
5230c3a9
export
default
async
function
RootLayout
({
children
}:
LayoutProps
<
'/'
>
)
{
return
(
<
html
>
<
body
>
{
children
}
</
body
>
</
html
>
)
}
test/e2e/app-dir/cache-components-postpone-in-client/app/(index)/page.tsx
0 → 100644
View file @
5230c3a9
import
Link
from
'next/link'
export
default
async
function
Page
()
{
return
(
<
main
>
<
h2
>
Suspense above body
</
h2
>
<
ul
>
<
li
>
<
Link
href=
"/suspense-above-body/use-params/123"
>
/suspense-above-body/use-params/123
</
Link
>
</
li
>
<
li
>
<
Link
href=
"/suspense-above-body/use-search-params"
>
/suspense-above-body/use-search-params
</
Link
>
</
li
>
</
ul
>
<
h2
>
Suspense inside body
</
h2
>
<
ul
>
<
li
>
<
Link
href=
"/suspense-inside-body/use-params/123"
>
/suspense-inside-body/use-params/123
</
Link
>
</
li
>
<
li
>
<
Link
href=
"/suspense-inside-body/use-search-params"
>
/suspense-inside-body/use-search-params
</
Link
>
</
li
>
</
ul
>
<
h2
>
instant = false
</
h2
>
<
ul
>
<
li
>
<
Link
href=
"/instant-false/use-params/123"
>
/instant-false/use-params/123
</
Link
>
</
li
>
<
li
>
<
Link
href=
"/instant-false/use-search-params"
>
/instant-false/use-search-params
</
Link
>
</
li
>
</
ul
>
</
main
>
)
}
test/e2e/app-dir/cache-components-postpone-in-client/app/instant-false/layout.tsx
0 → 100644
View file @
5230c3a9
export
const
unstable_instant
=
false
export
default
async
function
RootLayout
({
children
}:
LayoutProps
<
'/'
>
)
{
return
(
<
html
>
<
body
>
<
p
>
This root layout has
<
code
>
instant = false
</
code
>
and no suspense
boundaries.
</
p
>
<
hr
/>
{
children
}
</
body
>
</
html
>
)
}
test/e2e/app-dir/cache-components-postpone-in-client/app/instant-false/use-params/[slug]/client.tsx
0 → 100644
View file @
5230c3a9
'use client'
import
{
useParams
}
from
'next/navigation'
export
function
ClientSlug
()
{
const
{
slug
}
=
useParams
()
return
<
div
>
Slug:
{
slug
}
</
div
>
}
test/e2e/app-dir/cache-components-postpone-in-client/app/instant-false/use-params/[slug]/page.tsx
0 → 100644
View file @
5230c3a9
import
{
ClientSlug
}
from
'./client'
export
default
async
function
Page
()
{
return
(
<
main
>
<
p
>
This page suspends on params in a client component.
</
p
>
<
ClientSlug
/>
</
main
>
)
}
test/e2e/app-dir/cache-components-postpone-in-client/app/instant-false/use-search-params/client.tsx
0 → 100644
View file @
5230c3a9
'use client'
import
{
useSearchParams
}
from
'next/navigation'
export
function
ClientSearch
()
{
const
search
=
useSearchParams
()
return
<
div
>
Search:
{
search
.
toString
()
}
</
div
>
}
test/e2e/app-dir/cache-components-postpone-in-client/app/instant-false/use-search-params/page.tsx
0 → 100644
View file @
5230c3a9
import
{
ClientSearch
}
from
'./client'
export
default
async
function
Page
()
{
return
(
<
main
>
<
p
>
This page suspends on search params in a client component.
</
p
>
<
ClientSearch
/>
</
main
>
)
}
test/e2e/app-dir/cache-components-postpone-in-client/app/suspense-above-body/layout.tsx
0 → 100644
View file @
5230c3a9
import
{
Suspense
}
from
'react'
export
default
async
function
RootLayout
({
children
}:
LayoutProps
<
'/'
>
)
{
return
(
<
Suspense
>
<
html
>
<
body
>
<
p
>
This root layout has a Suspense above the body.
</
p
>
<
hr
/>
{
children
}
</
body
>
</
html
>
</
Suspense
>
)
}
test/e2e/app-dir/cache-components-postpone-in-client/app/suspense-above-body/use-params/[slug]/client.tsx
0 → 100644
View file @
5230c3a9
'use client'
import
{
useParams
}
from
'next/navigation'
export
function
ClientSlug
()
{
const
{
slug
}
=
useParams
()
return
<
div
>
Slug:
{
slug
}
</
div
>
}
test/e2e/app-dir/cache-components-postpone-in-client/app/suspense-above-body/use-params/[slug]/page.tsx
0 → 100644
View file @
5230c3a9
import
{
ClientSlug
}
from
'./client'
export
default
async
function
Page
()
{
return
(
<
main
>
<
p
>
This page suspends on params in a client component.
</
p
>
<
ClientSlug
/>
</
main
>
)
}
test/e2e/app-dir/cache-components-postpone-in-client/app/suspense-above-body/use-search-params/client.tsx
0 → 100644
View file @
5230c3a9
'use client'
import
{
useSearchParams
}
from
'next/navigation'
export
function
ClientSearch
()
{
const
search
=
useSearchParams
()
return
<
div
>
Search:
{
search
.
toString
()
}
</
div
>
}
test/e2e/app-dir/cache-components-postpone-in-client/app/suspense-above-body/use-search-params/page.tsx
0 → 100644
View file @
5230c3a9
import
{
ClientSearch
}
from
'./client'
export
default
async
function
Page
()
{
return
(
<
main
>
<
p
>
This page suspends on search params in a client component.
</
p
>
<
ClientSearch
/>
</
main
>
)
}
test/e2e/app-dir/cache-components-postpone-in-client/app/suspense-inside-body/layout.tsx
0 → 100644
View file @
5230c3a9
import
{
Suspense
}
from
'react'
export
default
async
function
Layout
({
children
}:
LayoutProps
<
'/'
>
)
{
return
(
<
html
>
<
body
>
<
p
>
This root layout has a Suspense inside the body.
</
p
>
<
hr
/>
<
Suspense
fallback=
{
<
div
>
Loading...
</
div
>
}
>
{
children
}
</
Suspense
>
</
body
>
</
html
>
)
}
test/e2e/app-dir/cache-components-postpone-in-client/app/suspense-inside-body/use-params/[slug]/client.tsx
0 → 100644
View file @
5230c3a9
'use client'
import
{
useParams
}
from
'next/navigation'
export
function
ClientSlug
()
{
const
{
slug
}
=
useParams
()
return
<
div
>
Slug:
{
slug
}
</
div
>
}
test/e2e/app-dir/cache-components-postpone-in-client/app/suspense-inside-body/use-params/[slug]/page.tsx
0 → 100644
View file @
5230c3a9
import
{
ClientSlug
}
from
'./client'
export
default
async
function
Page
()
{
return
(
<
main
>
<
p
>
This page suspends on params in a client component.
</
p
>
<
ClientSlug
/>
</
main
>
)
}
test/e2e/app-dir/cache-components-postpone-in-client/app/suspense-inside-body/use-search-params/client.tsx
0 → 100644
View file @
5230c3a9
'use client'
import
{
useSearchParams
}
from
'next/navigation'
export
function
ClientSearch
()
{
const
search
=
useSearchParams
()
return
<
div
>
Search:
{
search
.
toString
()
}
</
div
>
}
test/e2e/app-dir/cache-components-postpone-in-client/app/suspense-inside-body/use-search-params/page.tsx
0 → 100644
View file @
5230c3a9
import
{
ClientSearch
}
from
'./client'
export
default
async
function
Page
()
{
return
(
<
main
>
<
p
>
This page suspends on search params in a client component.
</
p
>
<
ClientSearch
/>
</
main
>
)
}
test/e2e/app-dir/cache-components-postpone-in-client/cache-components-postpone-in-client.test.ts
0 → 100644
View file @
5230c3a9
import
{
nextTestSetup
}
from
'../../../lib/e2e-utils'
describe
(
'cache components - postponing in client'
,
()
=>
{
const
{
next
,
isNextStart
}
=
nextTestSetup
({
files
:
__dirname
,
skipDeployment
:
true
,
skipStart
:
true
,
})
if
(
!
isNextStart
)
{
// TODO: test validation behavior in dev
it
.
skip
(
'Build-time only test'
,
()
=>
{})
return
}
const
prerender
=
async
(
pathname
:
string
)
=>
{
const
args
=
[
'--experimental-build-mode'
,
'generate'
,
'--debug-build-paths'
,
`app
${
pathname
}
/page.tsx`
,
]
return
await
next
.
build
({
args
,
env
:
{
NEXT_TEST_LOG_VALIDATION
:
'1'
,
},
})
}
beforeAll
(
async
()
=>
{
await
next
.
build
({
args
:
[
'--experimental-build-mode'
,
'compile'
]
})
})
// NOTE: These tests repro a bug that happens when the page
// - doesn't suspend in a server component
// - does suspend (postpone) in a client component.
// Adding a server dynamic hole makes the build errors go away.
describe
(
'with suspense above body'
,
()
=>
{
it
(
'prerenders a page that suspends on params in a client component'
,
async
()
=>
{
const
result
=
await
prerender
(
'/suspense-above-body/use-params/[slug]'
)
expect
(
result
.
cliOutput
).
not
.
toContain
(
'Error occurred prerendering page'
)
expect
(
result
.
exitCode
).
toBe
(
0
)
})
it
(
'prerenders a page that suspends on search params in a client component'
,
async
()
=>
{
const
result
=
await
prerender
(
'/suspense-above-body/use-search-params'
)
expect
(
result
.
cliOutput
).
not
.
toContain
(
'Error occurred prerendering page'
)
expect
(
result
.
exitCode
).
toBe
(
0
)
})
})
describe
(
'with suspense inside body'
,
()
=>
{
it
(
'prerenders a page that suspends on params in a client component'
,
async
()
=>
{
const
result
=
await
prerender
(
'/suspense-inside-body/use-params/[slug]'
)
expect
(
result
.
cliOutput
).
not
.
toContain
(
'Error occurred prerendering page'
)
expect
(
result
.
exitCode
).
toBe
(
0
)
})
it
(
'prerenders a page that suspends on search params in a client component'
,
async
()
=>
{
const
result
=
await
prerender
(
'/suspense-inside-body/use-search-params'
)
expect
(
result
.
cliOutput
).
not
.
toContain
(
'Error occurred prerendering page'
)
expect
(
result
.
exitCode
).
toBe
(
0
)
})
})
describe
(
'with instant = false'
,
()
=>
{
it
(
'prerenders a page that suspends on params in a client component'
,
async
()
=>
{
const
result
=
await
prerender
(
'/instant-false/use-params/[slug]'
)
expect
(
result
.
cliOutput
).
not
.
toContain
(
'Error occurred prerendering page'
)
expect
(
result
.
exitCode
).
toBe
(
0
)
})
it
(
'prerenders a page that suspends on search params in a client component'
,
async
()
=>
{
const
result
=
await
prerender
(
'/instant-false/use-search-params'
)
expect
(
result
.
cliOutput
).
not
.
toContain
(
'Error occurred prerendering page'
)
expect
(
result
.
exitCode
).
toBe
(
0
)
})
})
})
test/e2e/app-dir/cache-components-postpone-in-client/next.config.ts
0 → 100644
View file @
5230c3a9
import
type
{
NextConfig
}
from
'next'
const
nextConfig
:
NextConfig
=
{
cacheComponents
:
true
,
experimental
:
{
// reactDebugChannel: true,
prerenderEarlyExit
:
false
,
},
typescript
:
{
ignoreBuildErrors
:
true
,
},
}
export
default
nextConfig
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