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
f91cdec4
Unverified
Commit
f91cdec4
authored
Oct 23, 2024
by
Jiachi Liu
Committed by
GitHub
Oct 23, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: migrate rest async api usage in tests (#71663)
parent
03ff785c
Hide whitespace changes
Inline
Side-by-side
Showing
132 changed files
with
351 additions
and
187 deletions
+351
-187
validator.js
test/e2e/app-dir/actions/app/header/edge/validator.js
+1
-1
page.js
...he/fixtures/parallel-routes/app/@breadcrumbs/[id]/page.js
+2
-1
page.js
...2e/app-dir/app-css/app/loading-bug/[categorySlug]/page.js
+2
-1
page.js
...e2e/app-dir/app-css/app/not-found/clientcomponent/page.js
+2
-2
hooks.js
test/e2e/app-dir/app-esm-js/app/app/hooks.js
+1
-1
page.js
...r/app-fetch-deduping/app/bad-response-page/[slug]/page.js
+1
-1
page.js
test/e2e/app-dir/app-fetch-deduping/app/blog/[slug]/page.js
+1
-1
page.js
test/e2e/app-dir/app-middleware/app/headers/page.js
+2
-2
middleware.js
test/e2e/app-dir/app-middleware/middleware.js
+1
-1
page.js
...static/app/[region]/(default)/dynamic-area/[slug]/page.js
+1
-1
layout.js
...-dir/app-prefetch-static/app/[region]/(default)/layout.js
+1
-1
page.js
...tch-static/app/[region]/(default)/static-prefetch/page.js
+1
-1
page.js
test/e2e/app-dir/app-prefetch/app/dashboard/[id]/page.js
+2
-1
page.js
...e2e/app-dir/app-prefetch/app/prefetch-auto/[slug]/page.js
+2
-1
route.ts
...dir/app-routes/app/revalidate-1/[slug]/data.json/route.ts
+2
-1
route.ts
...e/app-dir/app-routes/app/static/[slug]/data.json/route.ts
+2
-1
page.js
test/e2e/app-dir/app-static/app/blog/[author]/[slug]/page.js
+2
-1
layout.js
test/e2e/app-dir/app-static/app/blog/[author]/layout.js
+5
-1
page.js
test/e2e/app-dir/app-static/app/blog/[author]/page.js
+2
-1
page.js
test/e2e/app-dir/app-static/app/dynamic-error/[id]/page.js
+2
-1
page.js
...r/app-static/app/dynamic-no-gen-params-ssr/[slug]/page.js
+2
-1
page.js
...p-dir/app-static/app/dynamic-no-gen-params/[slug]/page.js
+3
-1
page.js
...ir/app-static/app/force-dynamic-no-prerender/[id]/page.js
+1
-1
page.js
...dir/app-static/app/force-dynamic-prerender/[slug]/page.js
+2
-1
page.js
test/e2e/app-dir/app-static/app/force-static/[slug]/page.js
+2
-1
layout.js
test/e2e/app-dir/app-static/app/force-static/layout.js
+3
-3
page.js
...p-static/app/gen-params-dynamic-revalidate/[slug]/page.js
+2
-1
page.js
.../app-dir/app-static/app/gen-params-dynamic/[slug]/page.js
+2
-1
page.js
...rtial-gen-params-no-additional-lang/[lang]/[slug]/page.js
+2
-1
page.js
...rtial-gen-params-no-additional-slug/[lang]/[slug]/page.js
+2
-1
page.js
...r/app-static/app/partial-gen-params/[lang]/[slug]/page.js
+2
-1
page.js
...pp-dir/app-static/app/ssg-draft-mode/[[...route]]/page.js
+1
-1
page.js
...pp-static/app/static-to-dynamic-error-forced/[id]/page.js
+3
-2
page.js
...p-dir/app-static/app/static-to-dynamic-error/[id]/page.js
+3
-2
route.js
.../variable-revalidate/authorization/route-cookies/route.js
+1
-1
page.js
test/e2e/app-dir/app/app/back-forward/[id]/page.js
+3
-1
page.js
test/e2e/app-dir/app/app/catch-all-edge/[...slug]/page.js
+2
-1
page.js
...2e/app-dir/app/app/catch-all-optional/[[...slug]]/page.js
+2
-1
page.js
test/e2e/app-dir/app/app/catch-all/[...slug]/page.js
+2
-1
page.js
...e/app-dir/app/app/dashboard/deployments/info/[id]/page.js
+2
-1
layout.js
.../app-dir/app/app/dynamic-client/[category]/[id]/layout.js
+5
-1
page.js
...2e/app-dir/app/app/dynamic-client/[category]/[id]/page.js
+6
-1
layout.js
test/e2e/app-dir/app/app/dynamic-client/[category]/layout.js
+5
-1
layout.js
test/e2e/app-dir/app/app/dynamic-client/layout.js
+5
-1
layout.js
test/e2e/app-dir/app/app/dynamic/[category]/[id]/layout.js
+5
-1
page.js
test/e2e/app-dir/app/app/dynamic/[category]/[id]/page.js
+6
-1
layout.js
test/e2e/app-dir/app/app/dynamic/[category]/layout.js
+5
-1
layout.js
test/e2e/app-dir/app/app/dynamic/layout.js
+5
-1
page.js
test/e2e/app-dir/app/app/link-hard-push/[id]/page.js
+2
-1
page.js
test/e2e/app-dir/app/app/link-hard-replace/[id]/page.js
+2
-1
page.js
test/e2e/app-dir/app/app/loading-bug/[categorySlug]/page.js
+2
-1
page.js
test/e2e/app-dir/app/app/param-and-query/[slug]/page.js
+7
-3
page.js
test/e2e/app-dir/app/app/partial-match-[id]/page.js
+2
-2
page.js
...2e/app-dir/app/app/searchparams-normalization-bug/page.js
+2
-2
page.tsx
.../app-dir/custom-cache-control/app/app-ssg/[slug]/page.tsx
+2
-1
page.js
...dynamic-data/fixtures/cache-scoped/app/connection/page.js
+1
-1
page.js
...-dir/dynamic-data/fixtures/main/app/force-dynamic/page.js
+1
-1
page.js
...p-dir/dynamic-data/fixtures/main/app/force-static/page.js
+1
-1
page.js
.../app-dir/dynamic-data/fixtures/main/app/top-level/page.js
+1
-1
page.js
...namic-data/fixtures/require-static/app/connection/page.js
+1
-1
page.js
.../dynamic-data/fixtures/require-static/app/cookies/page.js
+1
-1
page.js
.../dynamic-data/fixtures/require-static/app/headers/page.js
+1
-1
page.tsx
...mic-io-segment-configs/app/dynamic-params/[slug]/page.tsx
+2
-1
route.ts
...2e/app-dir/edge-route-rewrite/app/dynamic/[slug]/route.ts
+2
-1
page.js
...e2e/app-dir/errors/app/ssr-error-client-component/page.js
+2
-2
page.tsx
...sue/app/app-future/[lang]/(dashboard)/[teamSlug]/page.tsx
+2
-1
page.tsx
...dir/headers-static-bailout/app/page-with-headers/page.tsx
+2
-2
page.js
test/e2e/app-dir/hooks/app/hooks/use-draft-mode/page.js
+2
-2
page.js
test/e2e/app-dir/hooks/app/hooks/use-headers/page.js
+2
-2
layout.tsx
...p-dir/layout-params/app/base/[param1]/[param2]/layout.tsx
+5
-4
layout.tsx
test/e2e/app-dir/layout-params/app/base/[param1]/layout.tsx
+5
-4
layout.tsx
test/e2e/app-dir/layout-params/app/base/layout.tsx
+5
-4
layout.tsx
...app-dir/layout-params/app/catchall/[...params]/layout.tsx
+5
-4
layout.tsx
test/e2e/app-dir/layout-params/app/layout.tsx
+5
-4
layout.tsx
...out-params/app/optional-catchall/[[...params]]/layout.tsx
+5
-4
page.js
test/e2e/app-dir/logging/app/headers/page.js
+2
-2
page.js
...2e/app-dir/next-after-app/app/nodejs/[id]/dynamic/page.js
+2
-1
page.js
...pp-dir/next-after-app/app/nodejs/[id]/with-action/page.js
+2
-1
page.js
...-dir/next-after-app/app/nodejs/[id]/with-metadata/page.js
+2
-1
page.js
...2e/app-dir/next-after-app/app/nodejs/nested-after/page.js
+1
-1
page.js
.../not-found-default/app/(group)/group-dynamic/[id]/page.js
+2
-1
page.js
...d/basic/app/dynamic-layout-without-not-found/[id]/page.js
+5
-1
page.js
test/e2e/app-dir/not-found/basic/app/dynamic/[id]/page.js
+5
-1
page.js
...t-found/basic/app/error-boundary/nested/[dynamic]/page.js
+2
-1
page.js
...ute-root-not-found/app/(group)/group-dynamic/[id]/page.js
+2
-1
default.js
.../intercepting-parallel-modal/[username]/@modal/default.js
+1
-1
page.tsx
...ault/app/[locale]/nested/[foo]/[bar]/@slot/[baz]/page.tsx
+1
-1
page.tsx
...ent/app/[locale]/nested/[foo]/[bar]/@slot0/[baz]/page.tsx
+1
-1
default.tsx
...egment/app/[locale]/nested/[foo]/[bar]/@slot0/default.tsx
+1
-1
page.tsx
...p/[locale]/nested/[foo]/[bar]/@slot1/[baz]/[qux]/page.tsx
+1
-1
page.tsx
...ent/app/[locale]/nested/[foo]/[bar]/@slot1/[baz]/page.tsx
+1
-1
page.tsx
...ted-non-catchalls/app/[locale]/nested/@slot0/bar/page.tsx
+1
-1
page.tsx
...ted-non-catchalls/app/[locale]/nested/@slot0/foo/page.tsx
+1
-1
page.tsx
...ted-non-catchalls/app/[locale]/nested/@slot1/baz/page.tsx
+1
-1
page.tsx
...on/app/dynamic-refresh/[dynamic]/@modal/(.)login/page.tsx
+5
-6
page.tsx
...outes-revalidation/app/dynamic-refresh/[dynamic]/page.tsx
+3
-3
page.tsx
...utes-revalidation/app/refreshing/@modal/(.)login/page.tsx
+3
-5
page.tsx
...-dir/parallel-routes-revalidation/app/refreshing/page.tsx
+3
-2
page.jsx
.../app-dir/ppr-full/app/dynamic-data/force-dynamic/page.jsx
+2
-1
page.jsx
...e/app-dir/ppr-full/app/dynamic-data/force-static/page.jsx
+2
-1
page.jsx
...p/dynamic-data/incidental-postpone/force-dynamic/page.jsx
+2
-1
page.jsx
...pp/dynamic-data/incidental-postpone/force-static/page.jsx
+2
-1
page.jsx
...ir/ppr-full/app/dynamic-data/incidental-postpone/page.jsx
+2
-2
page.jsx
test/e2e/app-dir/ppr-full/app/dynamic-data/page.jsx
+2
-2
page.jsx
...ppr-full/app/dynamic/force-dynamic/nested/[slug]/page.jsx
+5
-1
layout.jsx
...-full/app/fallback/client/params/layout/[slug]/layout.jsx
+6
-1
page.jsx
.../ppr-full/app/fallback/client/params/page/[slug]/page.jsx
+2
-1
page.jsx
...p-dir/ppr-full/app/fallback/dynamic/error/[slug]/page.jsx
+2
-1
page.jsx
...-dir/ppr-full/app/fallback/dynamic/params/[slug]/page.jsx
+4
-3
page.jsx
...ir/ppr-full/app/fallback/nested/params/[...slug]/page.jsx
+2
-1
page.jsx
.../e2e/app-dir/ppr-full/app/fallback/params/[slug]/page.jsx
+2
-1
page.jsx
test/e2e/app-dir/ppr-full/app/loading/[slug]/page.jsx
+5
-1
page.jsx
test/e2e/app-dir/ppr-full/app/nested/[slug]/page.jsx
+5
-1
page.jsx
...e/app-dir/ppr-full/app/no-suspense/nested/[slug]/page.jsx
+5
-1
page.jsx
test/e2e/app-dir/ppr-full/app/on-demand/[slug]/page.jsx
+5
-1
page.jsx
...r/ppr-navigations/incremental/app/[locale]/about/page.jsx
+5
-1
layout.jsx
...p-dir/ppr-navigations/incremental/app/[locale]/layout.jsx
+7
-1
page.jsx
...app-dir/ppr-navigations/incremental/app/[locale]/page.jsx
+5
-1
page.jsx
.../ppr-navigations/incremental/app/[locale]/static/page.jsx
+5
-1
page.tsx
...ns/prefetch-navigation/app/catch-all/[[...slug]]/page.tsx
+2
-1
page.tsx
test/e2e/app-dir/ppr-navigations/search-params/app/page.tsx
+2
-3
page.jsx
...pp-dir/ppr-navigations/simple/app/[locale]/about/page.jsx
+5
-1
layout.jsx
...2e/app-dir/ppr-navigations/simple/app/[locale]/layout.jsx
+7
-1
page.jsx
.../e2e/app-dir/ppr-navigations/simple/app/[locale]/page.jsx
+5
-1
page.jsx
.../e2e/app-dir/ppr/app/no-suspense/node/gsp/[slug]/page.jsx
+2
-1
page.jsx
test/e2e/app-dir/ppr/app/suspense/node/gsp/[slug]/page.jsx
+2
-1
page.tsx
test/e2e/app-dir/rewrites-redirects/app/[...params]/page.tsx
+2
-3
page.tsx
...r/router-stuck-dynamic-static-segment/app/[slug]/page.tsx
+2
-1
page.tsx
...ter-stuck-dynamic-static-segment/app/blog/[slug]/page.tsx
+2
-1
page.js
test/e2e/app-dir/rsc-basic/app/page.js
+2
-2
page.tsx
...p-dir/shallow-routing/app/(shallow)/dynamic/[id]/page.tsx
+2
-1
page.js
test/integration/app-dynamic-error/app/dynamic-error/page.js
+2
-2
No files found.
test/e2e/app-dir/actions/app/header/edge/validator.js
View file @
f91cdec4
...
@@ -3,7 +3,7 @@ import { cookies } from 'next/headers'
...
@@ -3,7 +3,7 @@ import { cookies } from 'next/headers'
export
function
validator
(
action
)
{
export
function
validator
(
action
)
{
return
async
function
(
arg
)
{
return
async
function
(
arg
)
{
'use server'
'use server'
const
auth
=
cookies
(
).
get
(
'edge-auth'
)
const
auth
=
(
await
cookies
()
).
get
(
'edge-auth'
)
if
(
auth
?.
value
!==
'1'
)
{
if
(
auth
?.
value
!==
'1'
)
{
throw
new
Error
(
'Unauthorized request'
)
throw
new
Error
(
'Unauthorized request'
)
}
}
...
...
test/e2e/app-dir/app-client-cache/fixtures/parallel-routes/app/@breadcrumbs/[id]/page.js
View file @
f91cdec4
export
default
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
return
(
return
(
<
div
>
<
div
>
Catchall
<
pre
>
{
JSON
.
stringify
(
params
)}
<
/pre>{' '
}
Catchall
<
pre
>
{
JSON
.
stringify
(
params
)}
<
/pre>{' '
}
...
...
test/e2e/app-dir/app-css/app/loading-bug/[categorySlug]/page.js
View file @
f91cdec4
...
@@ -7,7 +7,8 @@ const fetchCategory = async (categorySlug) => {
...
@@ -7,7 +7,8 @@ const fetchCategory = async (categorySlug) => {
return
categorySlug
+
'abc'
return
categorySlug
+
'abc'
}
}
export
default
function
Page
({
params
})
{
export
default
function
Page
(
props
)
{
const
params
=
use
(
props
.
params
)
const
category
=
use
(
fetchCategory
(
params
.
categorySlug
))
const
category
=
use
(
fetchCategory
(
params
.
categorySlug
))
return
<
div
id
=
"category-id"
>
{
category
}
<
/div
>
return
<
div
id
=
"category-id"
>
{
category
}
<
/div
>
...
...
test/e2e/app-dir/app-css/app/not-found/clientcomponent/page.js
View file @
f91cdec4
...
@@ -2,8 +2,8 @@
...
@@ -2,8 +2,8 @@
import
ClientComp
from
'./client-component'
import
ClientComp
from
'./client-component'
import
{
headers
}
from
'next/headers'
import
{
headers
}
from
'next/headers'
export
default
function
Page
()
{
export
default
async
function
Page
()
{
// Opt-in to SSR.
// Opt-in to SSR.
headers
()
await
headers
()
return
<
ClientComp
/>
return
<
ClientComp
/>
}
}
test/e2e/app-dir/app-esm-js/app/app/hooks.js
View file @
f91cdec4
...
@@ -3,7 +3,7 @@ import { ClientHooks } from './client-hooks'
...
@@ -3,7 +3,7 @@ import { ClientHooks } from './client-hooks'
import
{
headers
,
cookies
}
from
'next/headers'
import
{
headers
,
cookies
}
from
'next/headers'
export
function
useHooks
()
{
export
function
useHooks
()
{
headers
(
)
use
(
headers
()
)
use
(
cookies
())
use
(
cookies
())
return
<
ClientHooks
/>
return
<
ClientHooks
/>
}
}
test/e2e/app-dir/app-fetch-deduping/app/bad-response-page/[slug]/page.js
View file @
f91cdec4
...
@@ -20,7 +20,7 @@ export async function generateStaticParams() {
...
@@ -20,7 +20,7 @@ export async function generateStaticParams() {
]
]
}
}
export
default
async
function
Page
(
{
params
}
)
{
export
default
async
function
Page
()
{
const
data
=
await
fetch
(
const
data
=
await
fetch
(
`http://localhost:
${
process
.
env
.
TEST_SERVER_PORT
}
?status=404`
`http://localhost:
${
process
.
env
.
TEST_SERVER_PORT
}
?status=404`
).
then
((
res
)
=>
res
.
text
())
).
then
((
res
)
=>
res
.
text
())
...
...
test/e2e/app-dir/app-fetch-deduping/app/blog/[slug]/page.js
View file @
f91cdec4
...
@@ -18,7 +18,7 @@ export async function generateStaticParams() {
...
@@ -18,7 +18,7 @@ export async function generateStaticParams() {
]
]
}
}
export
default
async
function
Page
(
{
params
}
)
{
export
default
async
function
Page
()
{
const
data
=
await
fetch
(
const
data
=
await
fetch
(
`http://localhost:
${
process
.
env
.
TEST_SERVER_PORT
}
`
`http://localhost:
${
process
.
env
.
TEST_SERVER_PORT
}
`
).
then
((
res
)
=>
res
.
text
())
).
then
((
res
)
=>
res
.
text
())
...
...
test/e2e/app-dir/app-middleware/app/headers/page.js
View file @
f91cdec4
import
{
headers
}
from
'next/headers'
import
{
headers
}
from
'next/headers'
export
default
function
SSRPage
()
{
export
default
async
function
SSRPage
()
{
const
headersObj
=
Object
.
fromEntries
(
headers
())
const
headersObj
=
Object
.
fromEntries
(
await
headers
())
return
(
return
(
<>
<>
<
p
>
app
-
dir
<
/p
>
<
p
>
app
-
dir
<
/p
>
...
...
test/e2e/app-dir/app-middleware/middleware.js
View file @
f91cdec4
...
@@ -8,7 +8,7 @@ import { headers as nextHeaders, draftMode } from 'next/headers'
...
@@ -8,7 +8,7 @@ import { headers as nextHeaders, draftMode } from 'next/headers'
export
async
function
middleware
(
request
)
{
export
async
function
middleware
(
request
)
{
const
headersFromRequest
=
new
Headers
(
request
.
headers
)
const
headersFromRequest
=
new
Headers
(
request
.
headers
)
// It should be able to import and use `headers` inside middleware
// It should be able to import and use `headers` inside middleware
const
headersFromNext
=
nextHeaders
()
const
headersFromNext
=
await
nextHeaders
()
headersFromRequest
.
set
(
'x-from-middleware'
,
'hello-from-middleware'
)
headersFromRequest
.
set
(
'x-from-middleware'
,
'hello-from-middleware'
)
// make sure headers() from `next/headers` is behaving properly
// make sure headers() from `next/headers` is behaving properly
...
...
test/e2e/app-dir/app-prefetch-static/app/[region]/(default)/dynamic-area/[slug]/page.js
View file @
f91cdec4
export
default
async
function
DynamicPage
(
{
params
,
searchParams
}
)
{
export
default
async
function
DynamicPage
(
props
)
{
return
<
div
id
=
"dynamic-prefetch-page"
>
Hello
from
Dynamic
Prefetch
Page
<
/div
>
return
<
div
id
=
"dynamic-prefetch-page"
>
Hello
from
Dynamic
Prefetch
Page
<
/div
>
}
}
test/e2e/app-dir/app-prefetch-static/app/[region]/(default)/layout.js
View file @
f91cdec4
export
const
regions
=
[
'SE'
,
'DE'
]
export
const
regions
=
[
'SE'
,
'DE'
]
export
default
async
function
Layout
({
children
,
params
})
{
export
default
function
Layout
({
children
})
{
return
children
return
children
}
}
...
...
test/e2e/app-dir/app-prefetch-static/app/[region]/(default)/static-prefetch/page.js
View file @
f91cdec4
export
const
dynamic
=
'force-dynamic'
export
const
dynamic
=
'force-dynamic'
export
default
async
function
StaticPrefetchPage
({
params
}
)
{
export
default
function
StaticPrefetchPage
(
props
)
{
return
(
return
(
<
div
id
=
"static-prefetch-page"
>
<
div
id
=
"static-prefetch-page"
>
<
h1
>
Hello
from
Static
Prefetch
Page
<
/h1
>
<
h1
>
Hello
from
Static
Prefetch
Page
<
/h1
>
...
...
test/e2e/app-dir/app-prefetch/app/dashboard/[id]/page.js
View file @
f91cdec4
...
@@ -12,7 +12,8 @@ export function generateStaticParams() {
...
@@ -12,7 +12,8 @@ export function generateStaticParams() {
return
[{
id
:
'static'
}]
return
[{
id
:
'static'
}]
}
}
export
default
function
IdPage
({
params
})
{
export
default
function
IdPage
(
props
)
{
const
params
=
use
(
props
.
params
)
const
data
=
use
(
getData
())
const
data
=
use
(
getData
())
console
.
log
(
data
)
console
.
log
(
data
)
...
...
test/e2e/app-dir/app-prefetch/app/prefetch-auto/[slug]/page.js
View file @
f91cdec4
...
@@ -9,7 +9,8 @@ function getData() {
...
@@ -9,7 +9,8 @@ function getData() {
return
res
return
res
}
}
export
default
async
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
const
result
=
await
getData
()
const
result
=
await
getData
()
return
(
return
(
...
...
test/e2e/app-dir/app-routes/app/revalidate-1/[slug]/data.json/route.ts
View file @
f91cdec4
...
@@ -9,8 +9,9 @@ export function generateStaticParams() {
...
@@ -9,8 +9,9 @@ export function generateStaticParams() {
export
const
GET
=
async
(
export
const
GET
=
async
(
req
:
NextRequest
,
req
:
NextRequest
,
{
params
}
:
{
params
:
Promise
<
{
slug
:
string
}
>
}
props
:
{
params
:
Promise
<
{
slug
:
string
}
>
}
)
=>
{
)
=>
{
const
params
=
await
props
.
params
const
resolvedParams
=
await
params
const
resolvedParams
=
await
params
return
NextResponse
.
json
({
params
:
resolvedParams
,
now
:
Date
.
now
()
})
return
NextResponse
.
json
({
params
:
resolvedParams
,
now
:
Date
.
now
()
})
}
}
test/e2e/app-dir/app-routes/app/static/[slug]/data.json/route.ts
View file @
f91cdec4
...
@@ -7,8 +7,9 @@ export function generateStaticParams() {
...
@@ -7,8 +7,9 @@ export function generateStaticParams() {
export
const
GET
=
async
(
export
const
GET
=
async
(
req
:
NextRequest
,
req
:
NextRequest
,
{
params
}
:
{
params
:
Promise
<
{
slug
:
string
}
>
}
props
:
{
params
:
Promise
<
{
slug
:
string
}
>
}
)
=>
{
)
=>
{
const
params
=
await
props
.
params
const
resolvedParams
=
await
params
const
resolvedParams
=
await
params
return
NextResponse
.
json
({
params
:
resolvedParams
,
now
:
Date
.
now
()
})
return
NextResponse
.
json
({
params
:
resolvedParams
,
now
:
Date
.
now
()
})
}
}
test/e2e/app-dir/app-static/app/blog/[author]/[slug]/page.js
View file @
f91cdec4
...
@@ -2,7 +2,8 @@ import { notFound } from 'next/navigation'
...
@@ -2,7 +2,8 @@ import { notFound } from 'next/navigation'
export
const
dynamicParams
=
true
export
const
dynamicParams
=
true
export
default
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
if
(
params
.
author
===
'shu'
)
{
if
(
params
.
author
===
'shu'
)
{
notFound
()
notFound
()
}
}
...
...
test/e2e/app-dir/app-static/app/blog/[author]/layout.js
View file @
f91cdec4
export
default
function
Layout
({
children
,
params
})
{
export
default
async
function
Layout
(
props
)
{
const
params
=
await
props
.
params
const
{
children
}
=
props
return
(
return
(
<>
<>
<
p
id
=
"author-layout-params"
>
{
JSON
.
stringify
(
params
)}
<
/p
>
<
p
id
=
"author-layout-params"
>
{
JSON
.
stringify
(
params
)}
<
/p
>
...
...
test/e2e/app-dir/app-static/app/blog/[author]/page.js
View file @
f91cdec4
...
@@ -2,7 +2,8 @@ import Link from 'next/link'
...
@@ -2,7 +2,8 @@ import Link from 'next/link'
export
const
dynamicParams
=
false
export
const
dynamicParams
=
false
export
default
async
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
await
fetch
(
'https://example.vercel.sh'
,
{
await
fetch
(
'https://example.vercel.sh'
,
{
next
:
{
revalidate
:
10
},
next
:
{
revalidate
:
10
},
})
})
...
...
test/e2e/app-dir/app-static/app/dynamic-error/[id]/page.js
View file @
f91cdec4
...
@@ -2,7 +2,8 @@ import { cookies } from 'next/headers'
...
@@ -2,7 +2,8 @@ import { cookies } from 'next/headers'
export
const
dynamic
=
'error'
export
const
dynamic
=
'error'
export
default
async
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
// When PPR is enabled, we will bailout on parameter access.
// When PPR is enabled, we will bailout on parameter access.
if
(
!
process
.
env
.
__NEXT_EXPERIMENTAL_PPR
)
{
if
(
!
process
.
env
.
__NEXT_EXPERIMENTAL_PPR
)
{
if
(
params
.
id
.
includes
(
'static-bailout'
))
{
if
(
params
.
id
.
includes
(
'static-bailout'
))
{
...
...
test/e2e/app-dir/app-static/app/dynamic-no-gen-params-ssr/[slug]/page.js
View file @
f91cdec4
export
const
revalidate
=
0
export
const
revalidate
=
0
export
default
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
return
(
return
(
<>
<>
<
p
id
=
"page"
>
/dynamic-no-gen-params-ssr</
p
>
<
p
id
=
"page"
>
/dynamic-no-gen-params-ssr</
p
>
...
...
test/e2e/app-dir/app-static/app/dynamic-no-gen-params/[slug]/page.js
View file @
f91cdec4
'use client'
'use client'
import
{
use
}
from
'react'
import
Link
from
'next/link'
import
Link
from
'next/link'
export
default
function
Page
({
params
})
{
export
default
function
Page
(
props
)
{
const
params
=
use
(
props
.
params
)
return
(
return
(
<>
<>
<
p
id
=
"page"
>
/dynamic-no-gen-params</
p
>
<
p
id
=
"page"
>
/dynamic-no-gen-params</
p
>
...
...
test/e2e/app-dir/app-static/app/force-dynamic-no-prerender/[id]/page.js
View file @
f91cdec4
export
const
dynamic
=
'force-dynamic'
export
const
dynamic
=
'force-dynamic'
export
default
function
Page
(
{
params
}
)
{
export
default
function
Page
(
props
)
{
throw
new
Error
(
'this should not attempt prerendering with force-dynamic'
)
throw
new
Error
(
'this should not attempt prerendering with force-dynamic'
)
}
}
test/e2e/app-dir/app-static/app/force-dynamic-prerender/[slug]/page.js
View file @
f91cdec4
...
@@ -8,7 +8,8 @@ export const generateStaticParams = async () => {
...
@@ -8,7 +8,8 @@ export const generateStaticParams = async () => {
return
[{
slug
:
'frameworks'
}]
return
[{
slug
:
'frameworks'
}]
}
}
export
default
async
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
const
result
=
(
await
cookies
()).
get
(
'session'
)?.
value
const
result
=
(
await
cookies
()).
get
(
'session'
)?.
value
?
'has cookie'
?
'has cookie'
:
'no cookie'
:
'no cookie'
...
...
test/e2e/app-dir/app-static/app/force-static/[slug]/page.js
View file @
f91cdec4
...
@@ -13,7 +13,8 @@ function Dynamic({ params }) {
...
@@ -13,7 +13,8 @@ function Dynamic({ params }) {
return
<
p
id
=
"params"
>
{
JSON
.
stringify
(
params
)}
<
/p
>
return
<
p
id
=
"params"
>
{
JSON
.
stringify
(
params
)}
<
/p
>
}
}
export
default
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
return
(
return
(
<
Suspense
>
<
Suspense
>
<
p
id
=
"page"
>
/force-static/
[
slug
]
<
/p
>
<
p
id
=
"page"
>
/force-static/
[
slug
]
<
/p
>
...
...
test/e2e/app-dir/app-static/app/force-static/layout.js
View file @
f91cdec4
import
{
cookies
,
headers
}
from
'next/headers'
import
{
cookies
,
headers
}
from
'next/headers'
export
default
function
Layout
({
children
})
{
export
default
async
function
Layout
({
children
})
{
const
curHeaders
=
headers
()
const
curHeaders
=
await
headers
()
const
curCookies
=
cookies
()
const
curCookies
=
await
cookies
()
return
(
return
(
<>
<>
...
...
test/e2e/app-dir/app-static/app/gen-params-dynamic-revalidate/[slug]/page.js
View file @
f91cdec4
...
@@ -6,7 +6,8 @@ export async function generateStaticParams() {
...
@@ -6,7 +6,8 @@ export async function generateStaticParams() {
return
[{
slug
:
'one'
}]
return
[{
slug
:
'one'
}]
}
}
export
default
async
function
page
({
params
})
{
export
default
async
function
page
(
props
)
{
const
params
=
await
props
.
params
const
{
slug
}
=
params
const
{
slug
}
=
params
let
data
let
data
...
...
test/e2e/app-dir/app-static/app/gen-params-dynamic/[slug]/page.js
View file @
f91cdec4
...
@@ -4,7 +4,8 @@ export async function generateStaticParams() {
...
@@ -4,7 +4,8 @@ export async function generateStaticParams() {
return
[{
slug
:
'one'
}]
return
[{
slug
:
'one'
}]
}
}
export
default
async
function
page
({
params
})
{
export
default
async
function
page
(
props
)
{
const
params
=
await
props
.
params
const
{
slug
}
=
params
const
{
slug
}
=
params
const
data
=
await
fetchRetry
(
const
data
=
await
fetchRetry
(
'https://next-data-api-endpoint.vercel.app/api/random'
,
'https://next-data-api-endpoint.vercel.app/api/random'
,
...
...
test/e2e/app-dir/app-static/app/partial-gen-params-no-additional-lang/[lang]/[slug]/page.js
View file @
f91cdec4
...
@@ -23,7 +23,8 @@ export async function generateStaticParams() {
...
@@ -23,7 +23,8 @@ export async function generateStaticParams() {
]
]
}
}
export
default
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
return
(
return
(
<>
<>
<
p
id
=
"page"
>
/partial-gen-params/
[
lang
]
/
[
slug
]
<
/p
>
<
p
id
=
"page"
>
/partial-gen-params/
[
lang
]
/
[
slug
]
<
/p
>
...
...
test/e2e/app-dir/app-static/app/partial-gen-params-no-additional-slug/[lang]/[slug]/page.js
View file @
f91cdec4
...
@@ -23,7 +23,8 @@ export async function generateStaticParams() {
...
@@ -23,7 +23,8 @@ export async function generateStaticParams() {
]
]
}
}
export
default
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
return
(
return
(
<>
<>
<
p
id
=
"page"
>
/partial-gen-params/
[
lang
]
/
[
slug
]
<
/p
>
<
p
id
=
"page"
>
/partial-gen-params/
[
lang
]
/
[
slug
]
<
/p
>
...
...
test/e2e/app-dir/app-static/app/partial-gen-params/[lang]/[slug]/page.js
View file @
f91cdec4
export
default
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
return
(
return
(
<>
<>
<
p
id
=
"page"
>
/partial-gen-params/
[
lang
]
/
[
slug
]
<
/p
>
<
p
id
=
"page"
>
/partial-gen-params/
[
lang
]
/
[
slug
]
<
/p
>
...
...
test/e2e/app-dir/app-static/app/ssg-draft-mode/[[...route]]/page.js
View file @
f91cdec4
...
@@ -5,7 +5,7 @@ export default async function Page() {
...
@@ -5,7 +5,7 @@ export default async function Page() {
'https://next-data-api-endpoint.vercel.app/api/random'
'https://next-data-api-endpoint.vercel.app/api/random'
).
then
((
res
)
=>
res
.
text
())
).
then
((
res
)
=>
res
.
text
())
const
{
isEnabled
}
=
draftMode
()
const
{
isEnabled
}
=
await
draftMode
()
return
(
return
(
<
main
>
<
main
>
...
...
test/e2e/app-dir/app-static/app/static-to-dynamic-error-forced/[id]/page.js
View file @
f91cdec4
...
@@ -2,9 +2,10 @@ import { cookies } from 'next/headers'
...
@@ -2,9 +2,10 @@ import { cookies } from 'next/headers'
export
const
dynamic
=
'force-static'
export
const
dynamic
=
'force-static'
export
default
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
if
(
params
.
id
.
includes
(
'static-bailout'
))
{
if
(
params
.
id
.
includes
(
'static-bailout'
))
{
console
.
log
(
'calling cookies'
,
cookies
())
console
.
log
(
'calling cookies'
,
await
cookies
())
}
}
return
(
return
(
...
...
test/e2e/app-dir/app-static/app/static-to-dynamic-error/[id]/page.js
View file @
f91cdec4
import
{
cookies
}
from
'next/headers'
import
{
cookies
}
from
'next/headers'
export
default
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
if
(
params
.
id
.
includes
(
'static-bailout'
))
{
if
(
params
.
id
.
includes
(
'static-bailout'
))
{
console
.
log
(
'calling cookies'
,
cookies
())
console
.
log
(
'calling cookies'
,
await
cookies
())
}
}
return
(
return
(
...
...
test/e2e/app-dir/app-static/app/variable-revalidate/authorization/route-cookies/route.js
View file @
f91cdec4
...
@@ -2,7 +2,7 @@ import { cookies } from 'next/headers'
...
@@ -2,7 +2,7 @@ import { cookies } from 'next/headers'
import
{
NextResponse
}
from
'next/server'
import
{
NextResponse
}
from
'next/server'
export
async
function
GET
()
{
export
async
function
GET
()
{
const
cookieData
=
cookies
()
const
cookieData
=
await
cookies
()
const
data
=
await
fetch
(
const
data
=
await
fetch
(
'https://next-data-api-endpoint.vercel.app/api/random'
,
'https://next-data-api-endpoint.vercel.app/api/random'
,
...
...
test/e2e/app-dir/app/app/back-forward/[id]/page.js
View file @
f91cdec4
'use client'
'use client'
import
{
use
}
from
'react'
import
Link
from
'next/link'
import
Link
from
'next/link'
import
{
useRouter
}
from
'next/navigation'
import
{
useRouter
}
from
'next/navigation'
export
default
function
Page
({
params
})
{
export
default
function
Page
(
props
)
{
const
params
=
use
(
props
.
params
)
const
router
=
useRouter
()
const
router
=
useRouter
()
return
(
return
(
<>
<>
...
...
test/e2e/app-dir/app/app/catch-all-edge/[...slug]/page.js
View file @
f91cdec4
export
const
runtime
=
'edge'
export
const
runtime
=
'edge'
export
default
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
return
(
return
(
<>
<>
<
p
>
catch
-
all
edge
page
<
/p
>
<
p
>
catch
-
all
edge
page
<
/p
>
...
...
test/e2e/app-dir/app/app/catch-all-optional/[[...slug]]/page.js
View file @
f91cdec4
export
default
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
return
(
return
(
<
h1
id
=
"text"
data
-
params
=
{
params
.
slug
?.
join
(
'/'
)
??
''
}
>
<
h1
id
=
"text"
data
-
params
=
{
params
.
slug
?.
join
(
'/'
)
??
''
}
>
hello
from
/catch-all-optional/
{
params
.
slug
?.
join
(
'/'
)}
hello
from
/catch-all-optional/
{
params
.
slug
?.
join
(
'/'
)}
...
...
test/e2e/app-dir/app/app/catch-all/[...slug]/page.js
View file @
f91cdec4
import
Widget
from
'./components/widget'
import
Widget
from
'./components/widget'
import
NotAPage
from
'./not-a-page'
import
NotAPage
from
'./not-a-page'
export
default
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
return
(
return
(
<>
<>
<
h1
id
=
"text"
data
-
params
=
{
params
.
slug
.
join
(
'/'
)
??
''
}
>
<
h1
id
=
"text"
data
-
params
=
{
params
.
slug
.
join
(
'/'
)
??
''
}
>
...
...
test/e2e/app-dir/app/app/dashboard/deployments/info/[id]/page.js
View file @
f91cdec4
export
default
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
return
(
return
(
<>
<>
<
p
id
=
"message"
>
<
p
id
=
"message"
>
...
...
test/e2e/app-dir/app/app/dynamic-client/[category]/[id]/layout.js
View file @
f91cdec4
export
default
function
IdLayout
({
children
,
params
})
{
export
default
async
function
IdLayout
(
props
)
{
const
params
=
await
props
.
params
const
{
children
}
=
props
return
(
return
(
<>
<>
<
h3
>
<
h3
>
...
...
test/e2e/app-dir/app/app/dynamic-client/[category]/[id]/page.js
View file @
f91cdec4
'use client'
'use client'
import
{
use
}
from
'react'
import
{
useSearchParams
}
from
'next/navigation'
import
{
useSearchParams
}
from
'next/navigation'
import
dynamic
from
'next/dynamic'
import
dynamic
from
'next/dynamic'
...
@@ -7,7 +8,11 @@ const Button = dynamic(() =>
...
@@ -7,7 +8,11 @@ const Button = dynamic(() =>
import
(
'../../../../components/button/button'
).
then
((
mod
)
=>
mod
.
Button
)
import
(
'../../../../components/button/button'
).
then
((
mod
)
=>
mod
.
Button
)
)
)
export
default
function
IdPage
({
children
,
params
})
{
export
default
function
IdPage
(
props
)
{
const
params
=
use
(
props
.
params
)
const
{
children
}
=
props
return
(
return
(
<>
<>
<
p
>
<
p
>
...
...
test/e2e/app-dir/app/app/dynamic-client/[category]/layout.js
View file @
f91cdec4
export
default
function
CategoryLayout
({
children
,
params
})
{
export
default
async
function
CategoryLayout
(
props
)
{
const
params
=
await
props
.
params
const
{
children
}
=
props
return
(
return
(
<>
<>
<
h2
>
<
h2
>
...
...
test/e2e/app-dir/app/app/dynamic-client/layout.js
View file @
f91cdec4
export
default
function
DynamicLayout
({
children
,
params
})
{
export
default
async
function
DynamicLayout
(
props
)
{
const
params
=
await
props
.
params
const
{
children
}
=
props
return
(
return
(
<>
<>
<
h1
>
<
h1
>
...
...
test/e2e/app-dir/app/app/dynamic/[category]/[id]/layout.js
View file @
f91cdec4
export
default
function
IdLayout
({
children
,
params
})
{
export
default
async
function
IdLayout
(
props
)
{
const
params
=
await
props
.
params
const
{
children
}
=
props
return
(
return
(
<>
<>
<
h3
>
<
h3
>
...
...
test/e2e/app-dir/app/app/dynamic/[category]/[id]/page.js
View file @
f91cdec4
export
default
async
function
IdPage
({
children
,
params
,
searchParams
})
{
export
default
async
function
IdPage
(
props
)
{
const
params
=
await
props
.
params
const
searchParams
=
await
props
.
searchParams
const
{
children
}
=
props
return
(
return
(
<>
<>
<
p
>
<
p
>
...
...
test/e2e/app-dir/app/app/dynamic/[category]/layout.js
View file @
f91cdec4
export
default
function
CategoryLayout
({
children
,
params
})
{
export
default
async
function
CategoryLayout
(
props
)
{
const
params
=
await
props
.
params
const
{
children
}
=
props
return
(
return
(
<>
<>
<
h2
>
<
h2
>
...
...
test/e2e/app-dir/app/app/dynamic/layout.js
View file @
f91cdec4
export
default
function
DynamicLayout
({
children
,
params
})
{
export
default
async
function
DynamicLayout
(
props
)
{
const
params
=
await
props
.
params
const
{
children
}
=
props
return
(
return
(
<>
<>
<
h1
>
<
h1
>
...
...
test/e2e/app-dir/app/app/link-hard-push/[id]/page.js
View file @
f91cdec4
import
Link
from
'next/link'
import
Link
from
'next/link'
import
{
nanoid
}
from
'nanoid'
import
{
nanoid
}
from
'nanoid'
export
default
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
const
other
=
params
.
id
===
'123'
?
'456'
:
'123'
const
other
=
params
.
id
===
'123'
?
'456'
:
'123'
return
(
return
(
<>
<>
...
...
test/e2e/app-dir/app/app/link-hard-replace/[id]/page.js
View file @
f91cdec4
import
Link
from
'next/link'
import
Link
from
'next/link'
import
{
nanoid
}
from
'nanoid'
import
{
nanoid
}
from
'nanoid'
export
default
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
const
other
=
params
.
id
===
'123'
?
'456'
:
'123'
const
other
=
params
.
id
===
'123'
?
'456'
:
'123'
return
(
return
(
<>
<>
...
...
test/e2e/app-dir/app/app/loading-bug/[categorySlug]/page.js
View file @
f91cdec4
...
@@ -7,7 +7,8 @@ const fetchCategory = async (categorySlug) => {
...
@@ -7,7 +7,8 @@ const fetchCategory = async (categorySlug) => {
return
categorySlug
+
'abc'
return
categorySlug
+
'abc'
}
}
export
default
function
Page
({
params
})
{
export
default
function
Page
(
props
)
{
const
params
=
use
(
props
.
params
)
const
category
=
use
(
fetchCategory
(
params
.
categorySlug
))
const
category
=
use
(
fetchCategory
(
params
.
categorySlug
))
return
<
div
id
=
"category-id"
>
{
category
}
<
/div
>
return
<
div
id
=
"category-id"
>
{
category
}
<
/div
>
...
...
test/e2e/app-dir/app/app/param-and-query/[slug]/page.js
View file @
f91cdec4
'use client'
'use client'
export
default
async
function
Page
({
params
,
searchParams
})
{
import
{
use
}
from
'react'
export
default
function
Page
(
props
)
{
const
searchParams
=
use
(
props
.
searchParams
)
const
params
=
use
(
props
.
params
)
return
(
return
(
<
h1
<
h1
id
=
"params-and-query"
id
=
"params-and-query"
data
-
params
=
{
params
.
slug
}
data
-
params
=
{
params
.
slug
}
data
-
query
=
{
(
await
searchParams
)
.
slug
}
data
-
query
=
{
searchParams
.
slug
}
>
>
hello
from
/param-and-query/
{
params
.
slug
}?
slug
=
{
(
await
searchParams
)
.
slug
}
hello
from
/param-and-query/
{
params
.
slug
}?
slug
=
{
searchParams
.
slug
}
<
/h1
>
<
/h1
>
)
)
}
}
test/e2e/app-dir/app/app/partial-match-[id]/page.js
View file @
f91cdec4
export
default
function
DeploymentsPage
(
props
)
{
export
default
async
function
DeploymentsPage
(
props
)
{
return
(
return
(
<>
<>
<
p
>
hello
from
app
/
partial
-
match
-
[
id
].
ID
is
:
{
props
.
params
.
id
}
<
/p
>
<
p
>
hello
from
app
/
partial
-
match
-
[
id
].
ID
is
:
{
(
await
props
.
params
)
.
id
}
<
/p
>
<
/
>
<
/
>
)
)
}
}
test/e2e/app-dir/app/app/searchparams-normalization-bug/page.js
View file @
f91cdec4
import
Button
from
'./client-component'
import
Button
from
'./client-component'
import
{
headers
}
from
'next/headers'
import
{
headers
}
from
'next/headers'
export
default
function
Page
()
{
export
default
async
function
Page
()
{
const
headerStore
=
headers
()
const
headerStore
=
await
headers
()
const
headerValue
=
headerStore
.
get
(
'test'
)
||
'empty'
const
headerValue
=
headerStore
.
get
(
'test'
)
||
'empty'
return
(
return
(
...
...
test/e2e/app-dir/custom-cache-control/app/app-ssg/[slug]/page.tsx
View file @
f91cdec4
...
@@ -8,7 +8,8 @@ export function generateStaticParams() {
...
@@ -8,7 +8,8 @@ export function generateStaticParams() {
]
]
}
}
export
default
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
return
(
return
(
<>
<>
<
p
>
/app-ssg/[slug]
</
p
>
<
p
>
/app-ssg/[slug]
</
p
>
...
...
test/e2e/app-dir/dynamic-data/fixtures/cache-scoped/app/connection/page.js
View file @
f91cdec4
...
@@ -3,7 +3,7 @@ import { unstable_cache as cache } from 'next/cache'
...
@@ -3,7 +3,7 @@ import { unstable_cache as cache } from 'next/cache'
const
cachedConnection
=
cache
(
async
()
=>
connection
())
const
cachedConnection
=
cache
(
async
()
=>
connection
())
export
default
async
function
Page
(
{
searchParams
}
)
{
export
default
async
function
Page
(
props
)
{
await
cachedConnection
()
await
cachedConnection
()
return
(
return
(
<
div
>
<
div
>
...
...
test/e2e/app-dir/dynamic-data/fixtures/main/app/force-dynamic/page.js
View file @
f91cdec4
...
@@ -17,7 +17,7 @@ export default async function Page({ searchParams }) {
...
@@ -17,7 +17,7 @@ export default async function Page({ searchParams }) {
<
/section
>
<
/section
>
<
section
id
=
"headers"
>
<
section
id
=
"headers"
>
<
h3
>
headers
<
/h3
>
<
h3
>
headers
<
/h3
>
{
Array
.
from
(
headers
(
).
entries
()).
map
(([
key
,
value
])
=>
{
{
Array
.
from
(
(
await
headers
()
).
entries
()).
map
(([
key
,
value
])
=>
{
if
(
key
===
'cookie'
)
return
null
if
(
key
===
'cookie'
)
return
null
return
(
return
(
<
div
key
=
{
key
}
>
<
div
key
=
{
key
}
>
...
...
test/e2e/app-dir/dynamic-data/fixtures/main/app/force-static/page.js
View file @
f91cdec4
...
@@ -17,7 +17,7 @@ export default async function Page({ searchParams }) {
...
@@ -17,7 +17,7 @@ export default async function Page({ searchParams }) {
<
/section
>
<
/section
>
<
section
id
=
"headers"
>
<
section
id
=
"headers"
>
<
h3
>
headers
<
/h3
>
<
h3
>
headers
<
/h3
>
{
Array
.
from
(
headers
(
).
entries
()).
map
(([
key
,
value
])
=>
{
{
Array
.
from
(
(
await
headers
()
).
entries
()).
map
(([
key
,
value
])
=>
{
if
(
key
===
'cookie'
)
return
null
if
(
key
===
'cookie'
)
return
null
return
(
return
(
<
div
key
=
{
key
}
>
<
div
key
=
{
key
}
>
...
...
test/e2e/app-dir/dynamic-data/fixtures/main/app/top-level/page.js
View file @
f91cdec4
...
@@ -15,7 +15,7 @@ export default async function Page({ searchParams }) {
...
@@ -15,7 +15,7 @@ export default async function Page({ searchParams }) {
</section>
</section>
<section id="headers">
<section id="headers">
<h3>headers</h3>
<h3>headers</h3>
{Array.from(
headers(
).entries()).map(([key, value]) => {
{Array.from(
(await headers()
).entries()).map(([key, value]) => {
if (key === '
cookie
') return null
if (key === '
cookie
') return null
return (
return (
<div key={key}>
<div key={key}>
...
...
test/e2e/app-dir/dynamic-data/fixtures/require-static/app/connection/page.js
View file @
f91cdec4
...
@@ -2,7 +2,7 @@ import { connection } from 'next/server'
...
@@ -2,7 +2,7 @@ import { connection } from 'next/server'
export
const
dynamic
=
'error'
export
const
dynamic
=
'error'
export
default
async
function
Page
(
{
searchParams
}
)
{
export
default
async
function
Page
(
props
)
{
await
connection
()
await
connection
()
return
(
return
(
<
div
>
<
div
>
...
...
test/e2e/app-dir/dynamic-data/fixtures/require-static/app/cookies/page.js
View file @
f91cdec4
...
@@ -2,7 +2,7 @@ import { cookies } from 'next/headers'
...
@@ -2,7 +2,7 @@ import { cookies } from 'next/headers'
export
const
dynamic
=
'error'
export
const
dynamic
=
'error'
export
default
async
function
Page
(
{
searchParams
}
)
{
export
default
async
function
Page
(
props
)
{
return
(
return
(
<
div
>
<
div
>
<
section
>
<
section
>
...
...
test/e2e/app-dir/dynamic-data/fixtures/require-static/app/headers/page.js
View file @
f91cdec4
...
@@ -11,7 +11,7 @@ export default async function Page() {
...
@@ -11,7 +11,7 @@ export default async function Page() {
<
/section
>
<
/section
>
<
section
id
=
"headers"
>
<
section
id
=
"headers"
>
<
h3
>
headers
<
/h3
>
<
h3
>
headers
<
/h3
>
{
Array
.
from
(
headers
(
).
entries
()).
map
(([
key
,
value
])
=>
{
{
Array
.
from
(
(
await
headers
()
).
entries
()).
map
(([
key
,
value
])
=>
{
if
(
key
===
'cookie'
)
return
null
if
(
key
===
'cookie'
)
return
null
return
(
return
(
<
div
key
=
{
key
}
>
<
div
key
=
{
key
}
>
...
...
test/e2e/app-dir/dynamic-io-segment-configs/app/dynamic-params/[slug]/page.tsx
View file @
f91cdec4
...
@@ -3,7 +3,8 @@ export async function generateStaticParams() {
...
@@ -3,7 +3,8 @@ export async function generateStaticParams() {
return
[{
slug
:
'foo'
},
{
slug
:
'bar'
},
{
slug
:
'baz'
}]
return
[{
slug
:
'foo'
},
{
slug
:
'bar'
},
{
slug
:
'baz'
}]
}
}
export
default
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
const
{
slug
}
=
params
const
{
slug
}
=
params
return
<
div
>
Hello from
{
slug
}
</
div
>
return
<
div
>
Hello from
{
slug
}
</
div
>
}
}
...
...
test/e2e/app-dir/edge-route-rewrite/app/dynamic/[slug]/route.ts
View file @
f91cdec4
export
const
runtime
=
'edge'
export
const
runtime
=
'edge'
export
const
dynamic
=
'force-dynamic'
export
const
dynamic
=
'force-dynamic'
export
function
GET
(
req
,
{
params
})
{
export
async
function
GET
(
req
,
props
)
{
const
params
=
await
props
.
params
return
new
Response
(
return
new
Response
(
`Hello from /app/dynamic/[slug]/route.ts. Slug:
${
params
.
slug
}
`
`Hello from /app/dynamic/[slug]/route.ts. Slug:
${
params
.
slug
}
`
)
)
...
...
test/e2e/app-dir/errors/app/ssr-error-client-component/page.js
View file @
f91cdec4
import
ClientComp
from
'./client-component'
import
ClientComp
from
'./client-component'
import
{
headers
}
from
'next/headers'
import
{
headers
}
from
'next/headers'
export
default
function
Page
()
{
export
default
async
function
Page
()
{
// Opt-in to SSR.
// Opt-in to SSR.
headers
()
await
headers
()
return
<
ClientComp
/>
return
<
ClientComp
/>
}
}
test/e2e/app-dir/front-redirect-issue/app/app-future/[lang]/(dashboard)/[teamSlug]/page.tsx
View file @
f91cdec4
import
{
redirect
,
notFound
}
from
'next/navigation'
import
{
redirect
,
notFound
}
from
'next/navigation'
export
default
async
function
TeamDashboardPage
({
params
}:
any
)
{
export
default
async
function
TeamDashboardPage
(
props
:
any
)
{
const
params
=
await
props
.
params
await
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
1000
))
await
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
1000
))
const
username
=
'vercel-user'
const
username
=
'vercel-user'
if
(
params
.
teamSlug
===
username
)
{
if
(
params
.
teamSlug
===
username
)
{
...
...
test/e2e/app-dir/headers-static-bailout/app/page-with-headers/page.tsx
View file @
f91cdec4
import
{
nanoid
}
from
'nanoid'
import
{
nanoid
}
from
'nanoid'
import
{
headers
}
from
'next/headers'
import
{
headers
}
from
'next/headers'
export
default
function
Page
()
{
export
default
async
function
Page
()
{
headers
()
await
headers
()
return
(
return
(
<>
<>
<
h1
>
Dynamic Page
</
h1
>
<
h1
>
Dynamic Page
</
h1
>
...
...
test/e2e/app-dir/hooks/app/hooks/use-draft-mode/page.js
View file @
f91cdec4
import
{
draftMode
}
from
'next/headers'
import
{
draftMode
}
from
'next/headers'
export
default
function
Page
()
{
export
default
async
function
Page
()
{
const
{
isEnabled
}
=
draftMode
()
const
{
isEnabled
}
=
await
draftMode
()
return
(
return
(
<>
<>
...
...
test/e2e/app-dir/hooks/app/hooks/use-headers/page.js
View file @
f91cdec4
import
{
headers
}
from
'next/headers'
import
{
headers
}
from
'next/headers'
export
default
function
Page
()
{
export
default
async
function
Page
()
{
const
headersList
=
headers
()
const
headersList
=
await
headers
()
const
hasHeader
=
headersList
.
get
(
'x-use-headers'
)
===
'value'
const
hasHeader
=
headersList
.
get
(
'x-use-headers'
)
===
'value'
const
referer
=
headersList
.
get
(
'referer'
)
const
referer
=
headersList
.
get
(
'referer'
)
...
...
test/e2e/app-dir/layout-params/app/base/[param1]/[param2]/layout.tsx
View file @
f91cdec4
import
React
from
'react'
import
React
from
'react'
import
ShowParams
from
'../../../show-params'
import
ShowParams
from
'../../../show-params'
export
default
async
function
Layout
({
export
default
async
function
Layout
(
props
:
{
children
,
params
,
}:
{
children
:
React
.
ReactNode
children
:
React
.
ReactNode
params
:
Promise
<
{}
>
params
:
Promise
<
{}
>
})
{
})
{
const
params
=
await
props
.
params
const
{
children
}
=
props
return
(
return
(
<
div
>
<
div
>
<
ShowParams
prefix=
"lvl3"
params=
{
await
params
}
/>
<
ShowParams
prefix=
"lvl3"
params=
{
await
params
}
/>
...
...
test/e2e/app-dir/layout-params/app/base/[param1]/layout.tsx
View file @
f91cdec4
import
React
from
'react'
import
React
from
'react'
import
ShowParams
from
'../../show-params'
import
ShowParams
from
'../../show-params'
export
default
async
function
Layout
({
export
default
async
function
Layout
(
props
:
{
children
,
params
,
}:
{
children
:
React
.
ReactNode
children
:
React
.
ReactNode
params
:
Promise
<
{}
>
params
:
Promise
<
{}
>
})
{
})
{
const
params
=
await
props
.
params
const
{
children
}
=
props
return
(
return
(
<
div
>
<
div
>
<
ShowParams
prefix=
"lvl2"
params=
{
await
params
}
/>
<
ShowParams
prefix=
"lvl2"
params=
{
await
params
}
/>
...
...
test/e2e/app-dir/layout-params/app/base/layout.tsx
View file @
f91cdec4
import
React
from
'react'
import
React
from
'react'
import
ShowParams
from
'../show-params'
import
ShowParams
from
'../show-params'
export
default
async
function
Layout
({
export
default
async
function
Layout
(
props
:
{
children
,
params
,
}:
{
children
:
React
.
ReactNode
children
:
React
.
ReactNode
params
:
Promise
<
{}
>
params
:
Promise
<
{}
>
})
{
})
{
const
params
=
await
props
.
params
const
{
children
}
=
props
return
(
return
(
<
div
>
<
div
>
<
ShowParams
prefix=
"lvl1"
params=
{
await
params
}
/>
<
ShowParams
prefix=
"lvl1"
params=
{
await
params
}
/>
...
...
test/e2e/app-dir/layout-params/app/catchall/[...params]/layout.tsx
View file @
f91cdec4
import
React
from
'react'
import
React
from
'react'
import
ShowParams
from
'../../show-params'
import
ShowParams
from
'../../show-params'
export
default
async
function
Layout
({
export
default
async
function
Layout
(
props
:
{
children
,
params
,
}:
{
children
:
React
.
ReactNode
children
:
React
.
ReactNode
params
:
Promise
<
{}
>
params
:
Promise
<
{}
>
})
{
})
{
const
params
=
await
props
.
params
const
{
children
}
=
props
return
(
return
(
<
div
>
<
div
>
<
ShowParams
prefix=
"lvl2"
params=
{
await
params
}
/>
<
ShowParams
prefix=
"lvl2"
params=
{
await
params
}
/>
...
...
test/e2e/app-dir/layout-params/app/layout.tsx
View file @
f91cdec4
import
React
from
'react'
import
React
from
'react'
import
ShowParams
from
'./show-params'
import
ShowParams
from
'./show-params'
export
default
async
function
Layout
({
export
default
async
function
Layout
(
props
:
{
children
,
params
,
}:
{
children
:
React
.
ReactNode
children
:
React
.
ReactNode
params
:
Promise
<
{}
>
params
:
Promise
<
{}
>
})
{
})
{
const
params
=
await
props
.
params
const
{
children
}
=
props
return
(
return
(
<
html
>
<
html
>
<
head
></
head
>
<
head
></
head
>
...
...
test/e2e/app-dir/layout-params/app/optional-catchall/[[...params]]/layout.tsx
View file @
f91cdec4
import
React
from
'react'
import
React
from
'react'
import
ShowParams
from
'../../show-params'
import
ShowParams
from
'../../show-params'
export
default
async
function
Layout
({
export
default
async
function
Layout
(
props
:
{
children
,
params
,
}:
{
children
:
React
.
ReactNode
children
:
React
.
ReactNode
params
:
Promise
<
{}
>
params
:
Promise
<
{}
>
})
{
})
{
const
params
=
await
props
.
params
const
{
children
}
=
props
return
(
return
(
<
div
>
<
div
>
<
ShowParams
prefix=
"lvl2"
params=
{
await
params
}
/>
<
ShowParams
prefix=
"lvl2"
params=
{
await
params
}
/>
...
...
test/e2e/app-dir/logging/app/headers/page.js
View file @
f91cdec4
import
{
headers
}
from
'next/headers'
import
{
headers
}
from
'next/headers'
export
default
function
Page
()
{
export
default
async
function
Page
()
{
headers
()
await
headers
()
return
<
p
>
{
'headers()'
}
<
/p
>
return
<
p
>
{
'headers()'
}
<
/p
>
}
}
test/e2e/app-dir/next-after-app/app/nodejs/[id]/dynamic/page.js
View file @
f91cdec4
...
@@ -4,7 +4,8 @@ import { cliLog } from '../../../../utils/log'
...
@@ -4,7 +4,8 @@ import { cliLog } from '../../../../utils/log'
const
thing
=
cache
(()
=>
Symbol
(
'cache me please'
))
const
thing
=
cache
(()
=>
Symbol
(
'cache me please'
))
export
default
function
Index
({
params
})
{
export
default
async
function
Index
(
props
)
{
const
params
=
await
props
.
params
const
valueFromRender
=
thing
()
const
valueFromRender
=
thing
()
after
(()
=>
{
after
(()
=>
{
...
...
test/e2e/app-dir/next-after-app/app/nodejs/[id]/with-action/page.js
View file @
f91cdec4
...
@@ -4,7 +4,8 @@ import { cliLog } from '../../../../utils/log'
...
@@ -4,7 +4,8 @@ import { cliLog } from '../../../../utils/log'
const
thing
=
cache
(()
=>
Symbol
(
'cache me please'
))
const
thing
=
cache
(()
=>
Symbol
(
'cache me please'
))
export
default
function
Index
({
params
})
{
export
default
async
function
Index
(
props
)
{
const
params
=
await
props
.
params
const
action
=
async
()
=>
{
const
action
=
async
()
=>
{
'use server'
'use server'
...
...
test/e2e/app-dir/next-after-app/app/nodejs/[id]/with-metadata/page.js
View file @
f91cdec4
import
{
unstable_after
as
after
}
from
'next/server'
import
{
unstable_after
as
after
}
from
'next/server'
import
{
cliLog
}
from
'../../../../utils/log'
import
{
cliLog
}
from
'../../../../utils/log'
export
function
generateMetadata
({
params
})
{
export
async
function
generateMetadata
(
props
)
{
const
params
=
await
props
.
params
after
(()
=>
{
after
(()
=>
{
cliLog
({
cliLog
({
source
:
'[metadata] /[id]/with-metadata'
,
source
:
'[metadata] /[id]/with-metadata'
,
...
...
test/e2e/app-dir/next-after-app/app/nodejs/nested-after/page.js
View file @
f91cdec4
...
@@ -4,7 +4,7 @@ import { cliLog } from '../../../utils/log'
...
@@ -4,7 +4,7 @@ import { cliLog } from '../../../utils/log'
const
thing
=
cache
(()
=>
Symbol
(
'cache me please'
))
const
thing
=
cache
(()
=>
Symbol
(
'cache me please'
))
export
default
async
function
Index
(
{
params
}
)
{
export
default
async
function
Index
(
props
)
{
await
connection
()
await
connection
()
const
valueFromRender
=
thing
()
const
valueFromRender
=
thing
()
...
...
test/e2e/app-dir/not-found-default/app/(group)/group-dynamic/[id]/page.js
View file @
f91cdec4
import
{
notFound
}
from
'next/navigation'
import
{
notFound
}
from
'next/navigation'
export
default
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
if
(
params
.
id
===
'404'
)
{
if
(
params
.
id
===
'404'
)
{
notFound
()
notFound
()
}
}
...
...
test/e2e/app-dir/not-found/basic/app/dynamic-layout-without-not-found/[id]/page.js
View file @
f91cdec4
...
@@ -3,7 +3,11 @@ import { notFound } from 'next/navigation'
...
@@ -3,7 +3,11 @@ import { notFound } from 'next/navigation'
// avoid static generation to fill the dynamic params
// avoid static generation to fill the dynamic params
export
const
dynamic
=
'force-dynamic'
export
const
dynamic
=
'force-dynamic'
export
default
function
Page
({
params
:
{
id
}
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
const
{
id
}
=
params
if
(
id
===
'404'
)
{
if
(
id
===
'404'
)
{
notFound
()
notFound
()
}
}
...
...
test/e2e/app-dir/not-found/basic/app/dynamic/[id]/page.js
View file @
f91cdec4
...
@@ -3,7 +3,11 @@ import { notFound } from 'next/navigation'
...
@@ -3,7 +3,11 @@ import { notFound } from 'next/navigation'
// avoid static generation to fill the dynamic params
// avoid static generation to fill the dynamic params
export
const
dynamic
=
'force-dynamic'
export
const
dynamic
=
'force-dynamic'
export
default
function
Page
({
params
:
{
id
}
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
const
{
id
}
=
params
if
(
id
===
'404'
)
{
if
(
id
===
'404'
)
{
notFound
()
notFound
()
}
}
...
...
test/e2e/app-dir/not-found/basic/app/error-boundary/nested/[dynamic]/page.js
View file @
f91cdec4
import
{
notFound
}
from
'next/navigation'
import
{
notFound
}
from
'next/navigation'
import
React
from
'react'
import
React
from
'react'
export
default
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
if
(
params
.
dynamic
===
'trigger-not-found'
)
{
if
(
params
.
dynamic
===
'trigger-not-found'
)
{
notFound
()
notFound
()
}
}
...
...
test/e2e/app-dir/not-found/group-route-root-not-found/app/(group)/group-dynamic/[id]/page.js
View file @
f91cdec4
...
@@ -2,7 +2,8 @@ import { notFound } from 'next/navigation'
...
@@ -2,7 +2,8 @@ import { notFound } from 'next/navigation'
export
const
dynamic
=
'force-dynamic'
export
const
dynamic
=
'force-dynamic'
export
default
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
if
(
params
.
id
===
'404'
)
{
if
(
params
.
id
===
'404'
)
{
notFound
()
notFound
()
}
}
...
...
test/e2e/app-dir/parallel-routes-and-interception/app/(group)/intercepting-parallel-modal/[username]/@modal/default.js
View file @
f91cdec4
export
default
function
Page
(
{
params
}
)
{
export
default
function
Page
(
props
)
{
return
<
div
>
default
modal
slot
<
/div
>
return
<
div
>
default
modal
slot
<
/div
>
}
}
test/e2e/app-dir/parallel-routes-catchall-default/app/[locale]/nested/[foo]/[bar]/@slot/[baz]/page.tsx
View file @
f91cdec4
export
default
function
Page
(
{
params
}
)
{
export
default
function
Page
(
props
)
{
return
<
div
>
/[locale]/nested/[foo]/[bar]/@slot/[baz]/page.tsx
</
div
>
return
<
div
>
/[locale]/nested/[foo]/[bar]/@slot/[baz]/page.tsx
</
div
>
}
}
test/e2e/app-dir/parallel-routes-catchall-dynamic-segment/app/[locale]/nested/[foo]/[bar]/@slot0/[baz]/page.tsx
View file @
f91cdec4
export
default
function
Page
(
{
params
}
)
{
export
default
function
Page
(
props
)
{
return
<
div
>
/[locale]/nested/[foo]/[bar]/@slot0/[baz]/page.tsx
</
div
>
return
<
div
>
/[locale]/nested/[foo]/[bar]/@slot0/[baz]/page.tsx
</
div
>
}
}
test/e2e/app-dir/parallel-routes-catchall-dynamic-segment/app/[locale]/nested/[foo]/[bar]/@slot0/default.tsx
View file @
f91cdec4
export
default
function
Page
(
{
params
}
)
{
export
default
function
Page
(
props
)
{
return
<
div
>
/[locale]/nested/[foo]/[bar]/@slot0/default.tsx
</
div
>
return
<
div
>
/[locale]/nested/[foo]/[bar]/@slot0/default.tsx
</
div
>
}
}
test/e2e/app-dir/parallel-routes-catchall-dynamic-segment/app/[locale]/nested/[foo]/[bar]/@slot1/[baz]/[qux]/page.tsx
View file @
f91cdec4
export
default
function
Page
(
{
params
}
)
{
export
default
function
Page
(
props
)
{
return
<
div
>
/[locale]/nested/[foo]/[bar]/@slot1/[baz]/[qux]/page.tsx
</
div
>
return
<
div
>
/[locale]/nested/[foo]/[bar]/@slot1/[baz]/[qux]/page.tsx
</
div
>
}
}
test/e2e/app-dir/parallel-routes-catchall-dynamic-segment/app/[locale]/nested/[foo]/[bar]/@slot1/[baz]/page.tsx
View file @
f91cdec4
export
default
function
Page
(
{
params
}
)
{
export
default
function
Page
(
props
)
{
return
<
div
>
/[locale]/nested/[foo]/[bar]/@slot1/[baz]/page.tsx
</
div
>
return
<
div
>
/[locale]/nested/[foo]/[bar]/@slot1/[baz]/page.tsx
</
div
>
}
}
test/e2e/app-dir/parallel-routes-catchall-slotted-non-catchalls/app/[locale]/nested/@slot0/bar/page.tsx
View file @
f91cdec4
export
default
function
Page
(
{
params
}
)
{
export
default
function
Page
(
props
)
{
return
<
div
>
/[locale]/nested/@slot0/bar/page.tsx
</
div
>
return
<
div
>
/[locale]/nested/@slot0/bar/page.tsx
</
div
>
}
}
test/e2e/app-dir/parallel-routes-catchall-slotted-non-catchalls/app/[locale]/nested/@slot0/foo/page.tsx
View file @
f91cdec4
export
default
function
Page
(
{
params
}
)
{
export
default
function
Page
(
props
)
{
return
<
div
>
/[locale]/nested/@slot0/foo/page.tsx
</
div
>
return
<
div
>
/[locale]/nested/@slot0/foo/page.tsx
</
div
>
}
}
test/e2e/app-dir/parallel-routes-catchall-slotted-non-catchalls/app/[locale]/nested/@slot1/baz/page.tsx
View file @
f91cdec4
export
default
function
Page
(
{
params
}
)
{
export
default
function
Page
(
props
)
{
return
<
div
>
/[locale]/nested/@slot1/baz/page.tsx
</
div
>
return
<
div
>
/[locale]/nested/@slot1/baz/page.tsx
</
div
>
}
}
test/e2e/app-dir/parallel-routes-revalidation/app/dynamic-refresh/[dynamic]/@modal/(.)login/page.tsx
View file @
f91cdec4
...
@@ -4,12 +4,14 @@ import { UpdateSearchParamsButton } from '../../../../components/UpdateSearchPar
...
@@ -4,12 +4,14 @@ import { UpdateSearchParamsButton } from '../../../../components/UpdateSearchPar
const
getRandom
=
async
()
=>
Math
.
random
()
const
getRandom
=
async
()
=>
Math
.
random
()
export
default
async
function
Page
({
params
,
searchParams
})
{
export
default
async
function
Page
(
props
)
{
const
searchParams
=
await
props
.
searchParams
const
params
=
await
props
.
params
const
someProp
=
await
getRandom
()
const
someProp
=
await
getRandom
()
return
(
return
(
<
dialog
open
>
<
dialog
open
>
<
div
>
{
(
await
params
)
.
dynamic
}
</
div
>
<
div
>
{
params
.
dynamic
}
</
div
>
<
div
style=
{
{
display
:
'flex'
,
flexDirection
:
'column'
}
}
>
<
div
style=
{
{
display
:
'flex'
,
flexDirection
:
'column'
}
}
>
<
div
>
<
div
>
<
span
>
Modal Page
</
span
>
<
span
>
Modal Page
</
span
>
...
@@ -17,10 +19,7 @@ export default async function Page({ params, searchParams }) {
...
@@ -17,10 +19,7 @@ export default async function Page({ params, searchParams }) {
</
div
>
</
div
>
<
RefreshButton
/>
<
RefreshButton
/>
<
RevalidateButton
/>
<
RevalidateButton
/>
<
UpdateSearchParamsButton
<
UpdateSearchParamsButton
searchParams=
{
searchParams
}
id=
"modal"
/>
searchParams=
{
await
searchParams
}
id=
"modal"
/>
</
div
>
</
div
>
</
dialog
>
</
dialog
>
)
)
...
...
test/e2e/app-dir/parallel-routes-revalidation/app/dynamic-refresh/[dynamic]/page.tsx
View file @
f91cdec4
import
Link
from
'next/link'
import
Link
from
'next/link'
import
{
UpdateSearchParamsButton
}
from
'../../components/UpdateSearchParamsButton'
import
{
UpdateSearchParamsButton
}
from
'../../components/UpdateSearchParamsButton'
export
default
async
function
Home
(
{
searchParams
}
)
{
export
default
async
function
Home
(
props
)
{
const
s
p
=
await
searchParams
const
s
earchParams
=
await
props
.
searchParams
return
(
return
(
<
main
>
<
main
>
<
Link
href=
"/dynamic-refresh/foo/login"
>
<
Link
href=
"/dynamic-refresh/foo/login"
>
...
@@ -11,7 +11,7 @@ export default async function Home({ searchParams }) {
...
@@ -11,7 +11,7 @@ export default async function Home({ searchParams }) {
<
div
>
<
div
>
Random # from Root Page:
<
span
id=
"random-number"
>
{
Math
.
random
()
}
</
span
>
Random # from Root Page:
<
span
id=
"random-number"
>
{
Math
.
random
()
}
</
span
>
</
div
>
</
div
>
<
UpdateSearchParamsButton
searchParams=
{
s
p
}
/>
<
UpdateSearchParamsButton
searchParams=
{
s
earchParams
}
/>
</
main
>
</
main
>
)
)
}
}
test/e2e/app-dir/parallel-routes-revalidation/app/refreshing/@modal/(.)login/page.tsx
View file @
f91cdec4
...
@@ -4,7 +4,8 @@ import { UpdateSearchParamsButton } from '../../../components/UpdateSearchParams
...
@@ -4,7 +4,8 @@ import { UpdateSearchParamsButton } from '../../../components/UpdateSearchParams
const
getRandom
=
async
()
=>
Math
.
random
()
const
getRandom
=
async
()
=>
Math
.
random
()
export
default
async
function
Page
({
searchParams
})
{
export
default
async
function
Page
(
props
)
{
const
searchParams
=
await
props
.
searchParams
const
someProp
=
await
getRandom
()
const
someProp
=
await
getRandom
()
return
(
return
(
...
@@ -16,10 +17,7 @@ export default async function Page({ searchParams }) {
...
@@ -16,10 +17,7 @@ export default async function Page({ searchParams }) {
</
div
>
</
div
>
<
RefreshButton
/>
<
RefreshButton
/>
<
RevalidateButton
/>
<
RevalidateButton
/>
<
UpdateSearchParamsButton
<
UpdateSearchParamsButton
searchParams=
{
searchParams
}
id=
"modal"
/>
searchParams=
{
await
searchParams
}
id=
"modal"
/>
</
div
>
</
div
>
</
dialog
>
</
dialog
>
)
)
...
...
test/e2e/app-dir/parallel-routes-revalidation/app/refreshing/page.tsx
View file @
f91cdec4
import
Link
from
'next/link'
import
Link
from
'next/link'
import
{
UpdateSearchParamsButton
}
from
'../components/UpdateSearchParamsButton'
import
{
UpdateSearchParamsButton
}
from
'../components/UpdateSearchParamsButton'
export
default
async
function
Home
({
searchParams
})
{
export
default
async
function
Home
(
props
)
{
const
searchParams
=
await
props
.
searchParams
return
(
return
(
<
main
>
<
main
>
<
Link
href=
"/refreshing/login"
>
<
Link
href=
"/refreshing/login"
>
...
@@ -10,7 +11,7 @@ export default async function Home({ searchParams }) {
...
@@ -10,7 +11,7 @@ export default async function Home({ searchParams }) {
<
div
>
<
div
>
Random # from Root Page:
<
span
id=
"random-number"
>
{
Math
.
random
()
}
</
span
>
Random # from Root Page:
<
span
id=
"random-number"
>
{
Math
.
random
()
}
</
span
>
</
div
>
</
div
>
<
UpdateSearchParamsButton
searchParams=
{
await
searchParams
}
/>
<
UpdateSearchParamsButton
searchParams=
{
searchParams
}
/>
</
main
>
</
main
>
)
)
}
}
test/e2e/app-dir/ppr-full/app/dynamic-data/force-dynamic/page.jsx
View file @
f91cdec4
...
@@ -4,7 +4,8 @@ import { ServerHtml } from '../../../components/server-html'
...
@@ -4,7 +4,8 @@ import { ServerHtml } from '../../../components/server-html'
export
const
dynamic
=
'force-dynamic'
export
const
dynamic
=
'force-dynamic'
export
default
({
searchParams
})
=>
{
export
default
async
(
props
)
=>
{
const
searchParams
=
await
props
.
searchParams
return
(
return
(
<>
<>
<
ServerHtml
/>
<
ServerHtml
/>
...
...
test/e2e/app-dir/ppr-full/app/dynamic-data/force-static/page.jsx
View file @
f91cdec4
...
@@ -5,7 +5,8 @@ import { ServerHtml } from '../../../components/server-html'
...
@@ -5,7 +5,8 @@ import { ServerHtml } from '../../../components/server-html'
export
const
dynamic
=
'force-static'
export
const
dynamic
=
'force-static'
export
const
revalidate
=
60
export
const
revalidate
=
60
export
default
({
searchParams
})
=>
{
export
default
async
(
props
)
=>
{
const
searchParams
=
await
props
.
searchParams
return
(
return
(
<>
<>
<
ServerHtml
/>
<
ServerHtml
/>
...
...
test/e2e/app-dir/ppr-full/app/dynamic-data/incidental-postpone/force-dynamic/page.jsx
View file @
f91cdec4
...
@@ -4,7 +4,8 @@ import { ServerHtml } from '../../../../components/server-html'
...
@@ -4,7 +4,8 @@ import { ServerHtml } from '../../../../components/server-html'
export
const
dynamic
=
'force-dynamic'
export
const
dynamic
=
'force-dynamic'
export
default
({
searchParams
})
=>
{
export
default
async
(
props
)
=>
{
const
searchParams
=
await
props
.
searchParams
return
(
return
(
<>
<>
<
ServerHtml
/>
<
ServerHtml
/>
...
...
test/e2e/app-dir/ppr-full/app/dynamic-data/incidental-postpone/force-static/page.jsx
View file @
f91cdec4
...
@@ -4,7 +4,8 @@ import { ServerHtml } from '../../../../components/server-html'
...
@@ -4,7 +4,8 @@ import { ServerHtml } from '../../../../components/server-html'
export
const
dynamic
=
'force-static'
export
const
dynamic
=
'force-static'
export
default
({
searchParams
})
=>
{
export
default
async
(
props
)
=>
{
const
searchParams
=
await
props
.
searchParams
return
(
return
(
<>
<>
<
ServerHtml
/>
<
ServerHtml
/>
...
...
test/e2e/app-dir/ppr-full/app/dynamic-data/incidental-postpone/page.jsx
View file @
f91cdec4
...
@@ -2,12 +2,12 @@ import { Suspense, unstable_postpone as postpone } from 'react'
...
@@ -2,12 +2,12 @@ import { Suspense, unstable_postpone as postpone } from 'react'
import
{
Optimistic
}
from
'../../../components/optimistic'
import
{
Optimistic
}
from
'../../../components/optimistic'
import
{
ServerHtml
}
from
'../../../components/server-html'
import
{
ServerHtml
}
from
'../../../components/server-html'
export
default
(
{
searchParams
}
)
=>
{
export
default
(
props
)
=>
{
return
(
return
(
<>
<>
<
ServerHtml
/>
<
ServerHtml
/>
<
Suspense
fallback=
"loading..."
>
<
Suspense
fallback=
"loading..."
>
<
Optimistic
searchParams=
{
searchParams
}
/>
<
Optimistic
searchParams=
{
props
.
searchParams
}
/>
</
Suspense
>
</
Suspense
>
<
Suspense
fallback=
"loading..."
>
<
Suspense
fallback=
"loading..."
>
<
IncidentalPostpone
/>
<
IncidentalPostpone
/>
...
...
test/e2e/app-dir/ppr-full/app/dynamic-data/page.jsx
View file @
f91cdec4
...
@@ -2,12 +2,12 @@ import { Suspense } from 'react'
...
@@ -2,12 +2,12 @@ import { Suspense } from 'react'
import
{
Optimistic
}
from
'../../components/optimistic'
import
{
Optimistic
}
from
'../../components/optimistic'
import
{
ServerHtml
}
from
'../../components/server-html'
import
{
ServerHtml
}
from
'../../components/server-html'
export
default
(
{
searchParams
}
)
=>
{
export
default
(
props
)
=>
{
return
(
return
(
<>
<>
<
ServerHtml
/>
<
ServerHtml
/>
<
Suspense
fallback=
"loading..."
>
<
Suspense
fallback=
"loading..."
>
<
Optimistic
searchParams=
{
searchParams
}
/>
<
Optimistic
searchParams=
{
props
.
searchParams
}
/>
</
Suspense
>
</
Suspense
>
</>
</>
)
)
...
...
test/e2e/app-dir/ppr-full/app/dynamic/force-dynamic/nested/[slug]/page.jsx
View file @
f91cdec4
...
@@ -7,7 +7,11 @@ export function generateStaticParams() {
...
@@ -7,7 +7,11 @@ export function generateStaticParams() {
return
[]
return
[]
}
}
export
default
({
params
:
{
slug
}
})
=>
{
export
default
async
(
props
)
=>
{
const
params
=
await
props
.
params
const
{
slug
}
=
params
return
(
return
(
<
Suspense
<
Suspense
fallback=
{
fallback=
{
...
...
test/e2e/app-dir/ppr-full/app/fallback/client/params/layout/[slug]/layout.jsx
View file @
f91cdec4
'use client'
'use client'
import
{
use
}
from
'react'
import
Dynamic
from
'./dynamic'
import
Dynamic
from
'./dynamic'
export
default
function
Layout
({
children
,
params
})
{
export
default
function
Layout
(
props
)
{
const
params
=
use
(
props
.
params
)
const
{
children
}
=
props
return
(
return
(
<
div
data
-
file=
"app/fallback/client/params/[slug]/layout"
>
<
div
data
-
file=
"app/fallback/client/params/[slug]/layout"
>
{
children
}
{
children
}
...
...
test/e2e/app-dir/ppr-full/app/fallback/client/params/page/[slug]/page.jsx
View file @
f91cdec4
import
Dynamic
from
'./dynamic'
import
Dynamic
from
'./dynamic'
export
default
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
return
(
return
(
<
div
data
-
file=
"app/fallback/client/params/[slug]/page"
>
<
div
data
-
file=
"app/fallback/client/params/[slug]/page"
>
<
Dynamic
params=
{
params
}
/>
<
Dynamic
params=
{
params
}
/>
...
...
test/e2e/app-dir/ppr-full/app/fallback/dynamic/error/[slug]/page.jsx
View file @
f91cdec4
import
{
setTimeout
}
from
'timers/promises'
import
{
setTimeout
}
from
'timers/promises'
export
default
async
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
await
setTimeout
(
1000
)
await
setTimeout
(
1000
)
const
{
slug
}
=
params
const
{
slug
}
=
params
...
...
test/e2e/app-dir/ppr-full/app/fallback/dynamic/params/[slug]/page.jsx
View file @
f91cdec4
...
@@ -2,13 +2,14 @@ import { headers } from 'next/headers'
...
@@ -2,13 +2,14 @@ import { headers } from 'next/headers'
import
{
Suspense
}
from
'react'
import
{
Suspense
}
from
'react'
import
{
setTimeout
}
from
'timers/promises'
import
{
setTimeout
}
from
'timers/promises'
function
Dynamic
()
{
async
function
Dynamic
()
{
const
agent
=
headers
(
).
get
(
'user-agent'
)
const
agent
=
(
await
headers
()
).
get
(
'user-agent'
)
return
<
div
data
-
agent=
{
agent
}
>
{
agent
}
</
div
>
return
<
div
data
-
agent=
{
agent
}
>
{
agent
}
</
div
>
}
}
export
default
async
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
await
setTimeout
(
1000
)
await
setTimeout
(
1000
)
const
{
slug
}
=
params
const
{
slug
}
=
params
...
...
test/e2e/app-dir/ppr-full/app/fallback/nested/params/[...slug]/page.jsx
View file @
f91cdec4
import
{
setTimeout
}
from
'timers/promises'
import
{
setTimeout
}
from
'timers/promises'
export
default
async
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
await
setTimeout
(
1000
)
await
setTimeout
(
1000
)
return
<
div
data
-
slug=
{
params
.
slug
.
join
(
'/'
)
}
>
{
params
.
slug
.
join
(
'/'
)
}
</
div
>
return
<
div
data
-
slug=
{
params
.
slug
.
join
(
'/'
)
}
>
{
params
.
slug
.
join
(
'/'
)
}
</
div
>
...
...
test/e2e/app-dir/ppr-full/app/fallback/params/[slug]/page.jsx
View file @
f91cdec4
import
{
setTimeout
}
from
'timers/promises'
import
{
setTimeout
}
from
'timers/promises'
export
default
async
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
await
setTimeout
(
1000
)
await
setTimeout
(
1000
)
return
<
div
data
-
slug=
{
params
.
slug
}
>
{
params
.
slug
}
</
div
>
return
<
div
data
-
slug=
{
params
.
slug
}
>
{
params
.
slug
}
</
div
>
...
...
test/e2e/app-dir/ppr-full/app/loading/[slug]/page.jsx
View file @
f91cdec4
...
@@ -3,7 +3,11 @@ import { Dynamic } from '../../../components/dynamic'
...
@@ -3,7 +3,11 @@ import { Dynamic } from '../../../components/dynamic'
export
const
revalidate
=
60
export
const
revalidate
=
60
export
default
({
params
:
{
slug
}
})
=>
{
export
default
async
(
props
)
=>
{
const
params
=
await
props
.
params
const
{
slug
}
=
params
return
(
return
(
<
Suspense
fallback=
{
<
Dynamic
pathname=
{
`/loading/${slug}`
}
fallback
/>
}
>
<
Suspense
fallback=
{
<
Dynamic
pathname=
{
`/loading/${slug}`
}
fallback
/>
}
>
<
Dynamic
pathname=
{
`/loading/${slug}`
}
/>
<
Dynamic
pathname=
{
`/loading/${slug}`
}
/>
...
...
test/e2e/app-dir/ppr-full/app/nested/[slug]/page.jsx
View file @
f91cdec4
...
@@ -3,7 +3,11 @@ import { Dynamic } from '../../../components/dynamic'
...
@@ -3,7 +3,11 @@ import { Dynamic } from '../../../components/dynamic'
export
const
revalidate
=
60
export
const
revalidate
=
60
export
default
({
params
:
{
slug
}
})
=>
{
export
default
async
(
props
)
=>
{
const
params
=
await
props
.
params
const
{
slug
}
=
params
return
(
return
(
<
Suspense
fallback=
{
<
Dynamic
pathname=
{
`/nested/${slug}`
}
fallback
/>
}
>
<
Suspense
fallback=
{
<
Dynamic
pathname=
{
`/nested/${slug}`
}
fallback
/>
}
>
<
Dynamic
pathname=
{
`/nested/${slug}`
}
/>
<
Dynamic
pathname=
{
`/nested/${slug}`
}
/>
...
...
test/e2e/app-dir/ppr-full/app/no-suspense/nested/[slug]/page.jsx
View file @
f91cdec4
import
React
from
'react'
import
React
from
'react'
import
{
Dynamic
}
from
'../../../../components/dynamic'
import
{
Dynamic
}
from
'../../../../components/dynamic'
export
default
({
params
:
{
slug
}
})
=>
{
export
default
async
(
props
)
=>
{
const
params
=
await
props
.
params
const
{
slug
}
=
params
return
<
Dynamic
pathname=
{
`/no-suspense/nested/${slug}`
}
/>
return
<
Dynamic
pathname=
{
`/no-suspense/nested/${slug}`
}
/>
}
}
...
...
test/e2e/app-dir/ppr-full/app/on-demand/[slug]/page.jsx
View file @
f91cdec4
import
React
,
{
Suspense
}
from
'react'
import
React
,
{
Suspense
}
from
'react'
import
{
Dynamic
}
from
'../../../components/dynamic'
import
{
Dynamic
}
from
'../../../components/dynamic'
export
default
({
params
:
{
slug
}
})
=>
{
export
default
async
(
props
)
=>
{
const
params
=
await
props
.
params
const
{
slug
}
=
params
return
(
return
(
<
Suspense
fallback=
{
<
Dynamic
pathname=
{
`/on-demand/${slug}`
}
fallback
/>
}
>
<
Suspense
fallback=
{
<
Dynamic
pathname=
{
`/on-demand/${slug}`
}
fallback
/>
}
>
<
Dynamic
pathname=
{
`/on-demand/${slug}`
}
/>
<
Dynamic
pathname=
{
`/on-demand/${slug}`
}
/>
...
...
test/e2e/app-dir/ppr-navigations/incremental/app/[locale]/about/page.jsx
View file @
f91cdec4
...
@@ -2,6 +2,10 @@ import { TestPage } from '../../../components/page'
...
@@ -2,6 +2,10 @@ import { TestPage } from '../../../components/page'
export
const
experimental_ppr
=
true
export
const
experimental_ppr
=
true
export
default
function
Page
({
params
:
{
locale
}
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
const
{
locale
}
=
params
return
<
TestPage
pathname=
{
`/${locale}/about`
}
/>
return
<
TestPage
pathname=
{
`/${locale}/about`
}
/>
}
}
test/e2e/app-dir/ppr-navigations/incremental/app/[locale]/layout.jsx
View file @
f91cdec4
...
@@ -4,7 +4,13 @@ export async function generateStaticParams() {
...
@@ -4,7 +4,13 @@ export async function generateStaticParams() {
return
locales
.
map
((
locale
)
=>
({
locale
}))
return
locales
.
map
((
locale
)
=>
({
locale
}))
}
}
export
default
function
Layout
({
children
,
params
:
{
locale
}
})
{
export
default
async
function
Layout
(
props
)
{
const
params
=
await
props
.
params
const
{
locale
}
=
params
const
{
children
}
=
props
return
(
return
(
<
html
lang=
{
locale
}
>
<
html
lang=
{
locale
}
>
<
body
>
{
children
}
</
body
>
<
body
>
{
children
}
</
body
>
...
...
test/e2e/app-dir/ppr-navigations/incremental/app/[locale]/page.jsx
View file @
f91cdec4
import
{
TestPage
}
from
'../../components/page'
import
{
TestPage
}
from
'../../components/page'
export
default
function
Page
({
params
:
{
locale
}
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
const
{
locale
}
=
params
return
<
TestPage
pathname=
{
`/${locale}`
}
/>
return
<
TestPage
pathname=
{
`/${locale}`
}
/>
}
}
test/e2e/app-dir/ppr-navigations/incremental/app/[locale]/static/page.jsx
View file @
f91cdec4
import
{
TestPage
}
from
'../../../components/page'
import
{
TestPage
}
from
'../../../components/page'
export
default
function
Page
({
params
:
{
locale
}
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
const
{
locale
}
=
params
return
<
TestPage
pathname=
{
`/${locale}/static`
}
noDynamic
/>
return
<
TestPage
pathname=
{
`/${locale}/static`
}
noDynamic
/>
}
}
test/e2e/app-dir/ppr-navigations/prefetch-navigation/app/catch-all/[[...slug]]/page.tsx
View file @
f91cdec4
...
@@ -2,7 +2,8 @@ import { unstable_noStore } from 'next/cache'
...
@@ -2,7 +2,8 @@ import { unstable_noStore } from 'next/cache'
import
Link
from
'next/link'
import
Link
from
'next/link'
import
React
,
{
Suspense
}
from
'react'
import
React
,
{
Suspense
}
from
'react'
export
default
async
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
return
(
return
(
<
div
id=
{
`dynamic-page-${params.slug[0]}`
}
>
<
div
id=
{
`dynamic-page-${params.slug[0]}`
}
>
<
p
id=
"params"
>
Params:
{
JSON
.
stringify
(
params
)
}
</
p
>
<
p
id=
"params"
>
Params:
{
JSON
.
stringify
(
params
)
}
</
p
>
...
...
test/e2e/app-dir/ppr-navigations/search-params/app/page.tsx
View file @
f91cdec4
...
@@ -2,11 +2,10 @@ import Link from 'next/link'
...
@@ -2,11 +2,10 @@ import Link from 'next/link'
type
AnySearchParams
=
{
[
key
:
string
]:
string
|
Array
<
string
>
|
undefined
}
type
AnySearchParams
=
{
[
key
:
string
]:
string
|
Array
<
string
>
|
undefined
}
export
default
async
function
Page
({
export
default
async
function
Page
(
props
:
{
searchParams
,
}:
{
searchParams
:
Promise
<
AnySearchParams
>
searchParams
:
Promise
<
AnySearchParams
>
})
{
})
{
const
searchParams
=
await
props
.
searchParams
const
hasParams
=
Object
.
keys
(
searchParams
).
length
>
0
const
hasParams
=
Object
.
keys
(
searchParams
).
length
>
0
return
(
return
(
<>
<>
...
...
test/e2e/app-dir/ppr-navigations/simple/app/[locale]/about/page.jsx
View file @
f91cdec4
import
{
TestPage
}
from
'../../../components/page'
import
{
TestPage
}
from
'../../../components/page'
export
default
function
Page
({
params
:
{
locale
}
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
const
{
locale
}
=
params
return
<
TestPage
pathname=
{
`/${locale}/about`
}
/>
return
<
TestPage
pathname=
{
`/${locale}/about`
}
/>
}
}
test/e2e/app-dir/ppr-navigations/simple/app/[locale]/layout.jsx
View file @
f91cdec4
...
@@ -4,7 +4,13 @@ export async function generateStaticParams() {
...
@@ -4,7 +4,13 @@ export async function generateStaticParams() {
return
locales
.
map
((
locale
)
=>
({
locale
}))
return
locales
.
map
((
locale
)
=>
({
locale
}))
}
}
export
default
function
Layout
({
children
,
params
:
{
locale
}
})
{
export
default
async
function
Layout
(
props
)
{
const
params
=
await
props
.
params
const
{
locale
}
=
params
const
{
children
}
=
props
return
(
return
(
<
html
lang=
{
locale
}
>
<
html
lang=
{
locale
}
>
<
body
>
{
children
}
</
body
>
<
body
>
{
children
}
</
body
>
...
...
test/e2e/app-dir/ppr-navigations/simple/app/[locale]/page.jsx
View file @
f91cdec4
import
{
TestPage
}
from
'../../components/page'
import
{
TestPage
}
from
'../../components/page'
export
default
function
Page
({
params
:
{
locale
}
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
const
{
locale
}
=
params
return
<
TestPage
pathname=
{
`/${locale}`
}
/>
return
<
TestPage
pathname=
{
`/${locale}`
}
/>
}
}
test/e2e/app-dir/ppr/app/no-suspense/node/gsp/[slug]/page.jsx
View file @
f91cdec4
...
@@ -2,7 +2,8 @@ export function generateStaticParams() {
...
@@ -2,7 +2,8 @@ export function generateStaticParams() {
return
[{
slug
:
'foo'
}]
return
[{
slug
:
'foo'
}]
}
}
export
default
async
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
return
(
return
(
<
div
id=
"container"
>
<
div
id=
"container"
>
Hello World!
Hello World!
...
...
test/e2e/app-dir/ppr/app/suspense/node/gsp/[slug]/page.jsx
View file @
f91cdec4
...
@@ -4,7 +4,8 @@ export function generateStaticParams() {
...
@@ -4,7 +4,8 @@ export function generateStaticParams() {
return
[{
slug
:
'foo'
}]
return
[{
slug
:
'foo'
}]
}
}
export
default
async
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
return
(
return
(
<
div
id=
"container"
>
<
div
id=
"container"
>
Hello World!
Hello World!
...
...
test/e2e/app-dir/rewrites-redirects/app/[...params]/page.tsx
View file @
f91cdec4
export
default
async
function
Page
({
export
default
async
function
Page
(
props
:
{
params
,
}:
{
params
:
Promise
<
{
params
:
Array
<
string
>
}
>
params
:
Promise
<
{
params
:
Array
<
string
>
}
>
})
{
})
{
const
params
=
await
props
.
params
const
{
params
:
catchAllParams
}
=
await
params
const
{
params
:
catchAllParams
}
=
await
params
return
(
return
(
<
div
id=
"page"
className=
{
`page_${catchAllParams.join('_')}`
}
>
<
div
id=
"page"
className=
{
`page_${catchAllParams.join('_')}`
}
>
...
...
test/e2e/app-dir/router-stuck-dynamic-static-segment/app/[slug]/page.tsx
View file @
f91cdec4
import
Link
from
'next/link'
import
Link
from
'next/link'
export
default
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
return
(
return
(
<
div
>
<
div
>
<
h1
id=
"slug-page"
>
Visiting page
{
params
.
slug
}
</
h1
>
<
h1
id=
"slug-page"
>
Visiting page
{
params
.
slug
}
</
h1
>
...
...
test/e2e/app-dir/router-stuck-dynamic-static-segment/app/blog/[slug]/page.tsx
View file @
f91cdec4
import
Link
from
'next/link'
import
Link
from
'next/link'
export
default
function
Blog
({
params
})
{
export
default
async
function
Blog
(
props
)
{
const
params
=
await
props
.
params
return
(
return
(
<
div
id=
"blog-post-page"
>
<
div
id=
"blog-post-page"
>
<
h1
>
Blog post
{
params
.
slug
}
</
h1
>
<
h1
>
Blog post
{
params
.
slug
}
</
h1
>
...
...
test/e2e/app-dir/rsc-basic/app/page.js
View file @
f91cdec4
...
@@ -4,8 +4,8 @@ import { headers } from 'next/headers'
...
@@ -4,8 +4,8 @@ import { headers } from 'next/headers'
const
envVar
=
process
.
env
.
ENV_VAR_TEST
const
envVar
=
process
.
env
.
ENV_VAR_TEST
const
headerKey
=
'x-next-test-client'
const
headerKey
=
'x-next-test-client'
export
default
function
Index
()
{
export
default
async
function
Index
()
{
const
headersList
=
headers
()
const
headersList
=
await
headers
()
const
header
=
headersList
.
get
(
headerKey
)
const
header
=
headersList
.
get
(
headerKey
)
return
(
return
(
...
...
test/e2e/app-dir/shallow-routing/app/(shallow)/dynamic/[id]/page.tsx
View file @
f91cdec4
export
default
function
Page
({
params
})
{
export
default
async
function
Page
(
props
)
{
const
params
=
await
props
.
params
return
(
return
(
<>
<>
<
h1
id=
{
`page-id-${params.id}`
}
>
Page ID:
{
params
.
id
}
</
h1
>
<
h1
id=
{
`page-id-${params.id}`
}
>
Page ID:
{
params
.
id
}
</
h1
>
...
...
test/integration/app-dynamic-error/app/dynamic-error/page.js
View file @
f91cdec4
...
@@ -2,8 +2,8 @@ import { headers } from 'next/headers'
...
@@ -2,8 +2,8 @@ import { headers } from 'next/headers'
export
const
dynamic
=
'error'
export
const
dynamic
=
'error'
export
default
function
Page
()
{
export
default
async
function
Page
()
{
headers
()
await
headers
()
return
(
return
(
<>
<>
<
p
id
=
"page"
>
/dynamic-error</
p
>
<
p
id
=
"page"
>
/dynamic-error</
p
>
...
...
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