Unverified Commit 04cc2f2e authored by Joseph's avatar Joseph Committed by GitHub

docs: post release amends (#91715)

Fixes based on feedback post release

Fixes: https://github.com/vercel/next.js/pull/91715
parent 47230b12
...@@ -129,7 +129,7 @@ export default async function Page() { ...@@ -129,7 +129,7 @@ export default async function Page() {
} }
``` ```
```jsx filename="app/blog/[slug]/page.js" switcher ```jsx filename="app/blog/page.js" switcher
// Dummy imports // Dummy imports
import { getPosts } from '@/lib/posts' import { getPosts } from '@/lib/posts'
import { Post } from '@/ui/post' import { Post } from '@/ui/post'
......
...@@ -218,6 +218,7 @@ export async function generateStaticParams() { ...@@ -218,6 +218,7 @@ export async function generateStaticParams() {
return posts.map((post) => ({ return posts.map((post) => ({
slug: post.slug, slug: post.slug,
})) }))
}
export default async function Page({ params }) { export default async function Page({ params }) {
const { slug } = await params const { slug } = await params
......
...@@ -119,7 +119,7 @@ See the [`revalidateTag` API reference](/docs/app/api-reference/functions/revali ...@@ -119,7 +119,7 @@ See the [`revalidateTag` API reference](/docs/app/api-reference/functions/revali
`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). `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).
```tsx filename="app/lib/actions.ts" highlight={1,6} switcher ```tsx filename="app/lib/actions.ts" highlight={1,12} switcher
import { updateTag } from 'next/cache' import { updateTag } from 'next/cache'
import { redirect } from 'next/navigation' import { redirect } from 'next/navigation'
...@@ -136,7 +136,7 @@ export async function createPost(formData: FormData) { ...@@ -136,7 +136,7 @@ export async function createPost(formData: FormData) {
} }
``` ```
```jsx filename="app/lib/actions.js" highlight={1,6} switcher ```jsx filename="app/lib/actions.js" highlight={1,12} switcher
import { updateTag } from 'next/cache' import { updateTag } from 'next/cache'
import { redirect } from 'next/navigation' import { redirect } from 'next/navigation'
......
...@@ -151,9 +151,14 @@ export default async function Page() { ...@@ -151,9 +151,14 @@ export default async function Page() {
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. 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.
```tsx filename="app/blog/[slug]/page.tsx" switcher ```tsx filename="app/blog/[slug]/page.tsx" switcher
import { notFound } from 'next/navigation'
import { getPostBySlug } from '@/lib/posts' import { getPostBySlug } from '@/lib/posts'
export default async function Page({ params }: { params: { slug: string } }) { export default async function Page({
params,
}: {
params: Promise<{ slug: string }>
}) {
const { slug } = await params const { slug } = await params
const post = getPostBySlug(slug) const post = getPostBySlug(slug)
...@@ -166,6 +171,7 @@ export default async function Page({ params }: { params: { slug: string } }) { ...@@ -166,6 +171,7 @@ export default async function Page({ params }: { params: { slug: string } }) {
``` ```
```jsx filename="app/blog/[slug]/page.js" switcher ```jsx filename="app/blog/[slug]/page.js" switcher
import { notFound } from 'next/navigation'
import { getPostBySlug } from '@/lib/posts' import { getPostBySlug } from '@/lib/posts'
export default async function Page({ params }) { export default async function Page({ params }) {
......
...@@ -210,7 +210,7 @@ export default function Page() { ...@@ -210,7 +210,7 @@ export default function Page() {
```jsx filename="app/blog/page.js" switcher ```jsx filename="app/blog/page.js" switcher
import styles from './blog.module.css' import styles from './blog.module.css'
export default function Layout() { export default function Page() {
return <main className={styles.blog}></main> return <main className={styles.blog}></main>
} }
``` ```
......
...@@ -79,6 +79,19 @@ Before any Next.js work, find and read the relevant doc in `node_modules/next/di ...@@ -79,6 +79,19 @@ Before any Next.js work, find and read the relevant doc in `node_modules/next/di
@AGENTS.md @AGENTS.md
``` ```
<details>
<summary>For earlier versions</summary>
On version 16.1 and earlier, use the codemod to generate these files automatically:
```bash
npx @next/codemod@latest agents-md
```
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.
</details>
## Understanding AGENTS.md ## Understanding AGENTS.md
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/`. 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/`.
......
...@@ -534,7 +534,6 @@ module.exports = { ...@@ -534,7 +534,6 @@ module.exports = {
### Limitations of SRI ### Limitations of SRI
- **Experimental**: Feature may change or be removed - **Experimental**: Feature may change or be removed
- **Webpack only**: Not available with Turbopack
- **App Router only**: Not supported in Pages Router - **App Router only**: Not supported in Pages Router
- **Build-time only**: Cannot handle dynamically generated scripts - **Build-time only**: Cannot handle dynamically generated scripts
......
...@@ -112,7 +112,7 @@ Use `retry()` to prompt the user to recover from the error. When called, the fun ...@@ -112,7 +112,7 @@ Use `retry()` to prompt the user to recover from the error. When called, the fun
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. 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.
```tsx filename="app/custom-error-boundary.tsx" highlight={9,12} switcher ```tsx filename="app/custom-error-boundary.tsx" highlight={16,17} switcher
'use client' 'use client'
import { unstable_catchError } from 'next/error' import { unstable_catchError } from 'next/error'
...@@ -137,7 +137,7 @@ function ErrorFallback( ...@@ -137,7 +137,7 @@ function ErrorFallback(
export default unstable_catchError(ErrorFallback) export default unstable_catchError(ErrorFallback)
``` ```
```jsx filename="app/custom-error-boundary.js" highlight={7,10} switcher ```jsx filename="app/custom-error-boundary.js" highlight={9,10} switcher
'use client' 'use client'
import { unstable_catchError } from 'next/error' import { unstable_catchError } from 'next/error'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment