Skip to content

Commit f8d55fd

Browse files
Merge branch 'canary' into bugfix/docs/tailwind-installation
2 parents 16b7257 + 0b699b1 commit f8d55fd

File tree

56 files changed

+375
-193
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+375
-193
lines changed

docs/01-app/01-getting-started/08-error-handling.mdx

+4-2
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ You can call the [`notFound`](/docs/app/api-reference/functions/not-found) funct
152152
import { getPostBySlug } from '@/lib/posts'
153153

154154
export default async function Page({ params }: { params: { slug: string } }) {
155-
const post = getPostBySlug((await params).slug)
155+
const { slug } = await params
156+
const post = getPostBySlug(slug)
156157

157158
if (!post) {
158159
notFound()
@@ -166,7 +167,8 @@ export default async function Page({ params }: { params: { slug: string } }) {
166167
import { getPostBySlug } from '@/lib/posts'
167168

168169
export default async function Page({ params }) {
169-
const post = getPostBySlug((await params).slug)
170+
const { slug } = await params
171+
const post = getPostBySlug(slug)
170172

171173
if (!post) {
172174
notFound()

docs/01-app/03-building-your-application/01-routing/04-linking-and-navigating.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export default async function Profile({
9898
}: {
9999
params: Promise<{ id: string }>
100100
}) {
101-
const id = (await params).id
101+
const { id } = await params
102102
if (!id) {
103103
redirect('/login')
104104
}
@@ -122,7 +122,7 @@ async function fetchTeam(id) {
122122
}
123123

124124
export default async function Profile({ params }) {
125-
const id = (await params).id
125+
const { id } = await params
126126
if (!id) {
127127
redirect('/login')
128128
}

docs/01-app/03-building-your-application/01-routing/10-dynamic-routes.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ export default async function Page({
2727
}: {
2828
params: Promise<{ slug: string }>
2929
}) {
30-
const slug = (await params).slug
30+
const { slug } = await params
3131
return <div>My Post: {slug}</div>
3232
}
3333
```
3434

3535
```jsx filename="app/blog/[slug]/page.js" switcher
3636
export default async function Page({ params }) {
37-
const slug = (await params).slug
37+
const { slug } = await params
3838
return <div>My Post: {slug}</div>
3939
}
4040
```

docs/01-app/03-building-your-application/01-routing/13-route-handlers.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -278,13 +278,13 @@ export async function GET(
278278
request: Request,
279279
{ params }: { params: Promise<{ slug: string }> }
280280
) {
281-
const slug = (await params).slug // 'a', 'b', or 'c'
281+
const { slug } = await params // 'a', 'b', or 'c'
282282
}
283283
```
284284

285285
```js filename="app/items/[slug]/route.js" switcher
286286
export async function GET(request, { params }) {
287-
const slug = (await params).slug // 'a', 'b', or 'c'
287+
const { slug } = await params // 'a', 'b', or 'c'
288288
}
289289
```
290290

docs/01-app/03-building-your-application/01-routing/15-internationalization.mdx

+4-4
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export default async function Page({
7777
}: {
7878
params: Promise<{ lang: string }>
7979
}) {
80-
const lang = (await params).lang;
80+
const { lang } = await params
8181
return ...
8282
}
8383
```
@@ -86,7 +86,7 @@ export default async function Page({
8686
// You now have access to the current locale
8787
// e.g. /en-US/products -> `lang` is "en-US"
8888
export default async function Page({ params }) {
89-
const lang = (await params).lang;
89+
const { lang } = await params
9090
return ...
9191
}
9292
```
@@ -150,7 +150,7 @@ export default async function Page({
150150
}: {
151151
params: Promise<{ lang: 'en' | 'nl' }>
152152
}) {
153-
const lang = (await params).lang
153+
const { lang } = await params
154154
const dict = await getDictionary(lang) // en
155155
return <button>{dict.products.cart}</button> // Add to Cart
156156
}
@@ -160,7 +160,7 @@ export default async function Page({
160160
import { getDictionary } from './dictionaries'
161161

162162
export default async function Page({ params }) {
163-
const lang = (await params).lang
163+
const { lang } = await params
164164
const dict = await getDictionary(lang) // en
165165
return <button>{dict.products.cart}</button> // Add to Cart
166166
}

docs/01-app/03-building-your-application/02-data-fetching/04-incremental-static-regeneration.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export default async function Page({
5353
}: {
5454
params: Promise<{ id: string }>
5555
}) {
56-
const id = (await params).id
56+
const { id } = await params
5757
const post: Post = await fetch(`https://api.vercel.app/blog/${id}`).then(
5858
(res) => res.json()
5959
)

docs/01-app/03-building-your-application/06-optimizing/04-metadata.mdx

+6-4
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export async function generateMetadata(
6161
parent: ResolvingMetadata
6262
): Promise<Metadata> {
6363
// read route params
64-
const id = (await params).id
64+
const { id } = await params
6565

6666
// fetch data
6767
const product = await fetch(`https://.../${id}`).then((res) => res.json())
@@ -83,7 +83,7 @@ export default function Page({ params, searchParams }: Props) {}
8383
```jsx filename="app/products/[id]/page.js" switcher
8484
export async function generateMetadata({ params, searchParams }, parent) {
8585
// read route params
86-
const id = (await params).id
86+
const { id } = await params
8787

8888
// fetch data
8989
const product = await fetch(`https://.../${id}`).then((res) => res.json())
@@ -298,7 +298,8 @@ Our current recommendation for JSON-LD is to render structured data as a `<scrip
298298
299299
```tsx filename="app/products/[id]/page.tsx" switcher
300300
export default async function Page({ params }) {
301-
const product = await getProduct((await params).id)
301+
const { id } = await params
302+
const product = await getProduct(id)
302303

303304
const jsonLd = {
304305
'@context': 'https://schema.org',
@@ -323,7 +324,8 @@ export default async function Page({ params }) {
323324
324325
```jsx filename="app/products/[id]/page.js" switcher
325326
export default async function Page({ params }) {
326-
const product = await getProduct((await params).id)
327+
const { id } = await params
328+
const product = await getProduct(id)
327329

328330
const jsonLd = {
329331
'@context': 'https://schema.org',

docs/01-app/03-building-your-application/07-configuring/05-mdx.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ export default async function Page({
272272
}: {
273273
params: Promise<{ slug: string }>
274274
}) {
275-
const slug = (await params).slug
275+
const { slug } = await params
276276
const { default: Post } = await import(`@/content/${slug}.mdx`)
277277

278278
return <Post />
@@ -287,7 +287,7 @@ export const dynamicParams = false
287287

288288
```jsx filename="app/blog/[slug]/page.js" switcher
289289
export default async function Page({ params }) {
290-
const slug = (await params).slug
290+
const { slug } = await params
291291
const { default: Post } = await import(`@/content/${slug}.mdx`)
292292

293293
return <Post />

docs/01-app/04-api-reference/02-components/form.mdx

+8-6
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import Form from 'next/form'
1717
export default function Page() {
1818
return (
1919
<Form action="/search">
20-
{/* On submission, the input value will be appended to
20+
{/* On submission, the input value will be appended to
2121
the URL, e.g. /search?query=abc */}
2222
<input name="query" />
2323
<button type="submit">Submit</button>
@@ -32,7 +32,7 @@ import Form from 'next/form'
3232
export default function Search() {
3333
return (
3434
<Form action="/search">
35-
{/* On submission, the input value will be appended to
35+
{/* On submission, the input value will be appended to
3636
the URL, e.g. /search?query=abc */}
3737
<input name="query" />
3838
<button type="submit">Submit</button>
@@ -51,7 +51,7 @@ import Form from 'next/form'
5151
export default function Page() {
5252
return (
5353
<Form action="/search">
54-
{/* On submission, the input value will be appended to
54+
{/* On submission, the input value will be appended to
5555
the URL, e.g. /search?query=abc */}
5656
<input name="query" />
5757
<button type="submit">Submit</button>
@@ -66,7 +66,7 @@ import Form from 'next/form'
6666
export default function Search() {
6767
return (
6868
<Form action="/search">
69-
{/* On submission, the input value will be appended to
69+
{/* On submission, the input value will be appended to
7070
the URL, e.g. /search?query=abc */}
7171
<input name="query" />
7272
<button type="submit">Submit</button>
@@ -373,7 +373,8 @@ export default async function PostPage({
373373
}: {
374374
params: Promise<{ id: string }>
375375
}) {
376-
const data = await getPost((await params).id)
376+
const { id } = await params
377+
const data = await getPost(id)
377378

378379
return (
379380
<div>
@@ -388,7 +389,8 @@ export default async function PostPage({
388389
import { getPost } from '@/posts/data'
389390

390391
export default async function PostPage({ params }) {
391-
const data = await getPost((await params).id)
392+
const { id } = await params
393+
const data = await getPost(id)
392394

393395
return (
394396
<div>

docs/01-app/04-api-reference/03-file-conventions/default.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ export default async function Default({
3939
}: {
4040
params: Promise<{ artist: string }>
4141
}) {
42-
const artist = (await params).artist
42+
const { artist } = await params
4343
}
4444
```
4545

4646
```jsx filename="app/[artist]/@sidebar/default.js" switcher
4747
export default async function Default({ params }) {
48-
const artist = (await params).artist
48+
const { artist } = await params
4949
}
5050
```
5151

docs/01-app/04-api-reference/03-file-conventions/layout.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ export default async function Layout({
6565
}: {
6666
params: Promise<{ team: string }>
6767
}) {
68-
const team = (await params).team
68+
const { team } = await params
6969
}
7070
```
7171

7272
```jsx filename="app/dashboard/[team]/layout.js" switcher
7373
export default async function Layout({ params }) {
74-
const team = (await params).team
74+
const { team } = await params
7575
}
7676
```
7777

docs/01-app/04-api-reference/03-file-conventions/page.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ export default async function Page({
4444
}: {
4545
params: Promise<{ slug: string }>
4646
}) {
47-
const slug = (await params).slug
47+
const { slug } = await params
4848
}
4949
```
5050

5151
```jsx filename="app/shop/[slug]/page.js" switcher
5252
export default async function Page({ params }) {
53-
const slug = (await params).slug
53+
const { slug } = await params
5454
}
5555
```
5656

docs/01-app/04-api-reference/03-file-conventions/route.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@ export async function GET(
8686
request: Request,
8787
{ params }: { params: Promise<{ team: string }> }
8888
) {
89-
const team = (await params).team
89+
const { team } = await params
9090
}
9191
```
9292

9393
```js filename="app/dashboard/[team]/route.js" switcher
9494
export async function GET(request, { params }) {
95-
const team = (await params).team
95+
const { team } = await params
9696
}
9797
```
9898

docs/01-app/04-api-reference/04-functions/generate-metadata.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export async function generateMetadata(
9090
parent: ResolvingMetadata
9191
): Promise<Metadata> {
9292
// read route params
93-
const id = (await params).id
93+
const { id } = await params
9494

9595
// fetch data
9696
const product = await fetch(`https://.../${id}`).then((res) => res.json())
@@ -112,7 +112,7 @@ export default function Page({ params, searchParams }: Props) {}
112112
```jsx filename="app/products/[id]/page.js" switcher
113113
export async function generateMetadata({ params, searchParams }, parent) {
114114
// read route params
115-
const id = (await params).id
115+
const { id } = await params
116116

117117
// fetch data
118118
const product = await fetch(`https://.../${id}`).then((res) => res.json())

docs/01-app/04-api-reference/04-functions/not-found.mdx

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ async function fetchUser(id) {
1919
}
2020

2121
export default async function Profile({ params }) {
22-
const user = await fetchUser((await params).id)
22+
const { id } = await params
23+
const user = await fetchUser(id)
2324

2425
if (!user) {
2526
notFound()

docs/01-app/04-api-reference/04-functions/permanentRedirect.mdx

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ async function fetchTeam(id) {
4949
}
5050

5151
export default async function Profile({ params }) {
52-
const team = await fetchTeam((await params).id)
52+
const { id } = await params
53+
const team = await fetchTeam(id)
5354
if (!team) {
5455
permanentRedirect('/login')
5556
}

docs/01-app/04-api-reference/04-functions/unstable_cache.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default async function Page({
5555
}: {
5656
params: Promise<{ userId: string }>
5757
}) {
58-
const userId = (await params).userId
58+
const { userId } = await params
5959
const getCachedUser = unstable_cache(
6060
async () => {
6161
return { id: userId }
@@ -75,7 +75,7 @@ export default async function Page({
7575
import { unstable_cache } from 'next/cache';
7676

7777
export default async function Page({ params } }) {
78-
const userId = (await params).userId
78+
const { userId } = await params
7979
const getCachedUser = unstable_cache(
8080
async () => {
8181
return { id: userId };

examples/mdx-remote/app/[slug]/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default async function Blog({
1717
}: {
1818
params: Promise<{ slug: string }>;
1919
}) {
20-
const slug = (await params).slug;
20+
const { slug } = await params;
2121
const post = getPosts().find((post) => post.slug === slug);
2222

2323
if (!post) {

lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
"registry": "https://registry.npmjs.org/"
1717
}
1818
},
19-
"version": "15.2.1-canary.4"
19+
"version": "15.2.1-canary.5"
2020
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@
261261
"tree-kill": "1.2.2",
262262
"tsec": "0.2.1",
263263
"turbo": "2.3.3",
264-
"typescript": "5.7.2",
264+
"typescript": "5.8.2",
265265
"unfetch": "4.2.0",
266266
"wait-port": "0.2.2",
267267
"webpack": "5.98.0",

packages/create-next-app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-next-app",
3-
"version": "15.2.1-canary.4",
3+
"version": "15.2.1-canary.5",
44
"keywords": [
55
"react",
66
"next",

packages/eslint-config-next/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-config-next",
3-
"version": "15.2.1-canary.4",
3+
"version": "15.2.1-canary.5",
44
"description": "ESLint configuration used by Next.js.",
55
"main": "index.js",
66
"license": "MIT",
@@ -10,7 +10,7 @@
1010
},
1111
"homepage": "https://nextjs.org/docs/app/api-reference/config/eslint",
1212
"dependencies": {
13-
"@next/eslint-plugin-next": "15.2.1-canary.4",
13+
"@next/eslint-plugin-next": "15.2.1-canary.5",
1414
"@rushstack/eslint-patch": "^1.10.3",
1515
"@typescript-eslint/eslint-plugin": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0",
1616
"@typescript-eslint/parser": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0",

0 commit comments

Comments
 (0)