docs: post release amends (#91715) · vercel/next.js@3e37bb4

File tree

8 files changed

lines changed

    • 03-api-reference/04-functions

8 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -129,7 +129,7 @@ export default async function Page() {

129129

}

130130

```

131131
132-

```jsx filename="app/blog/[slug]/page.js" switcher

132+

```jsx filename="app/blog/page.js" switcher

133133

// Dummy imports

134134

import { getPosts } from '@/lib/posts'

135135

import { Post } from '@/ui/post'

Original file line numberDiff line numberDiff line change

@@ -218,6 +218,7 @@ export async function generateStaticParams() {

218218

return posts.map((post) => ({

219219

slug: post.slug,

220220

}))

221+

}

221222
222223

export default async function Page({ params }) {

223224

const { slug } = await params

Original file line numberDiff line numberDiff line change

@@ -119,7 +119,7 @@ See the [`revalidateTag` API reference](/docs/app/api-reference/functions/revali

119119
120120

`updateTag` immediately expires cached data for read-your-own-writes scenarios — the user sees their change right away instead of stale content. Unlike `revalidateTag`, it can only be used in [Server Actions](/docs/app/getting-started/mutating-data).

121121
122-

```tsx filename="app/lib/actions.ts" highlight={1,6} switcher

122+

```tsx filename="app/lib/actions.ts" highlight={1,12} switcher

123123

import { updateTag } from 'next/cache'

124124

import { redirect } from 'next/navigation'

125125

@@ -136,7 +136,7 @@ export async function createPost(formData: FormData) {

136136

}

137137

```

138138
139-

```jsx filename="app/lib/actions.js" highlight={1,6} switcher

139+

```jsx filename="app/lib/actions.js" highlight={1,12} switcher

140140

import { updateTag } from 'next/cache'

141141

import { redirect } from 'next/navigation'

142142
Original file line numberDiff line numberDiff line change

@@ -151,9 +151,14 @@ export default async function Page() {

151151

You can call the [`notFound`](/docs/app/api-reference/functions/not-found) function within a route segment and use the [`not-found.js`](/docs/app/api-reference/file-conventions/not-found) file to show a 404 UI.

152152
153153

```tsx filename="app/blog/[slug]/page.tsx" switcher

154+

import { notFound } from 'next/navigation'

154155

import { getPostBySlug } from '@/lib/posts'

155156
156-

export default async function Page({ params }: { params: { slug: string } }) {

157+

export default async function Page({

158+

params,

159+

}: {

160+

params: Promise<{ slug: string }>

161+

}) {

157162

const { slug } = await params

158163

const post = getPostBySlug(slug)

159164

@@ -166,6 +171,7 @@ export default async function Page({ params }: { params: { slug: string } }) {

166171

```

167172
168173

```jsx filename="app/blog/[slug]/page.js" switcher

174+

import { notFound } from 'next/navigation'

169175

import { getPostBySlug } from '@/lib/posts'

170176
171177

export default async function Page({ params }) {

Original file line numberDiff line numberDiff line change

@@ -210,7 +210,7 @@ export default function Page() {

210210

```jsx filename="app/blog/page.js" switcher

211211

import styles from './blog.module.css'

212212
213-

export default function Layout() {

213+

export default function Page() {

214214

return <main className={styles.blog}></main>

215215

}

216216

```

Original file line numberDiff line numberDiff line change

@@ -79,6 +79,19 @@ Before any Next.js work, find and read the relevant doc in `node_modules/next/di

7979

@AGENTS.md

8080

```

8181
82+

<details>

83+

<summary>For earlier versions</summary>

84+
85+

On version 16.1 and earlier, use the codemod to generate these files automatically:

86+
87+

```bash

88+

npx @next/codemod@latest agents-md

89+

```

90+
91+

The codemod outputs the bundled docs to `.next-docs/` in the project root instead of `node_modules/next/dist/docs/`, and the generated agent files will point to that directory.

92+
93+

</details>

94+
8295

## Understanding AGENTS.md

8396
8497

The default `AGENTS.md` contains a single, focused instruction: **read the bundled docs before writing code**. This is intentionally minimal — the goal is to redirect agents from stale training data to the accurate, version-matched documentation in `node_modules/next/dist/docs/`.

Original file line numberDiff line numberDiff line change

@@ -534,7 +534,6 @@ module.exports = {

534534

### Limitations of SRI

535535
536536

- **Experimental**: Feature may change or be removed

537-

- **Webpack only**: Not available with Turbopack

538537

- **App Router only**: Not supported in Pages Router

539538

- **Build-time only**: Cannot handle dynamically generated scripts

540539
Original file line numberDiff line numberDiff line change

@@ -112,7 +112,7 @@ Use `retry()` to prompt the user to recover from the error. When called, the fun

112112
113113

In most cases, use `retry()` instead of `reset()`. The `reset()` function only clears the error state and re-renders without re-fetching, which means it won't recover from Server Component errors.

114114
115-

```tsx filename="app/custom-error-boundary.tsx" highlight={9,12} switcher

115+

```tsx filename="app/custom-error-boundary.tsx" highlight={16,17} switcher

116116

'use client'

117117
118118

import { unstable_catchError } from 'next/error'

@@ -137,7 +137,7 @@ function ErrorFallback(

137137

export default unstable_catchError(ErrorFallback)

138138

```

139139
140-

```jsx filename="app/custom-error-boundary.js" highlight={7,10} switcher

140+

```jsx filename="app/custom-error-boundary.js" highlight={9,10} switcher

141141

'use client'

142142
143143

import { unstable_catchError } from 'next/error'