Skip to content

Conversation

@icyJoseph
Copy link
Collaborator

Additional group of docs improvements.

icyJoseph and others added 7 commits September 29, 2025 11:04
Without the `| null`, the following error appears during compilation:
```
TS2322: Type RefObject<HTMLDivElement | null> is not assignable to type RefObject<HTMLDivElement>
Type HTMLDivElement | null is not assignable to type HTMLDivElement
Type null is not assignable to type HTMLDivElement
```

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
## Documentation Update

This PR improves the dynamic routes example in the
`project-structure.mdx` page.

### Changes
- Updated catch-all segments example:
  - Before: `/shop/clothing/shoes`
  - After:  `/shop/clothing`
- Adjusted follow-up examples for consistency:
  - `/shop/a`, `/shop/a/b` → `/shop/clothing`, `/shop/clothing/shirts`

### Why
- Provides a clearer and more intuitive demonstration of how catch-all
segments work.
- Keeps the example consistent with other dynamic routes documentation.

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
We have dropped the example linked in this page. I'll re-evaluate later
if the section is still enough for a dev to understand how to set CORS
related headers.
…ame (#84045)

- Added a Note to the Middleware docs explaining that when
`pageExtensions` are customized (e.g. `.page.ts`), the Middleware file
should be named `middleware.page.ts` or `middleware.page.js`.
- Updated wording so `middleware.ts/js` is described as the default
filename, not a strict requirement.

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

-Added a callout note to middleware.mdx stating that if pageExtensions
is customized (e.g., .page.ts), the Middleware file should also match
(middleware.page.ts/js).
-Updated the language from “must” → “default is” for filename clarity.


### Why?

-Developers customizing pageExtensions were misled by the existing docs,
which implied middleware.ts/js was always required.
-This PR prevents confusion when Middleware isn’t recognized after a
pageExtensions change.


### How?
Edited docs/app/api-reference/file-conventions/middleware.mdx.
Inserted a > **Note** block right after the paragraph explaining where
to create the middleware file.


Closes NEXT-
Fixes #84008

-->

---------

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
Let's use a different title for these, otherwise we have a very long
composite word.
@ijjk ijjk added created-by: Next.js DevEx team PRs by the DX team. Documentation Related to Next.js' official documentation. labels Sep 29, 2025
@ijjk
Copy link
Member

ijjk commented Sep 29, 2025

Failing test suites

Commit: be6f71d | About building and testing Next.js

pnpm test-start-turbo test/e2e/app-dir/back-forward-cache/back-forward-cache.test.ts (turbopack)

  • back/forward cache > React state is preserved when navigating with back/forward buttons (DD)
  • back/forward cache > React state is preserved when navigating back/forward with links (DD)
  • back/forward cache > React state is preserved when navigating back to a page with different search params than before (DD)
  • back/forward cache > bfcache only preserves up to N entries (DD)
  • back/forward cache > navigate back and forth repeatedly between the same pages without evicting (DD)
Expand output

● back/forward cache › React state is preserved when navigating with back/forward buttons

next build failed with code/signal 1

  107 |             if (code || signal)
  108 |               reject(
> 109 |                 new Error(
      |                 ^
  110 |                   `next build failed with code/signal ${code || signal}`
  111 |                 )
  112 |               )

  at ChildProcess.<anonymous> (lib/next-modes/next-start.ts:109:17)

● back/forward cache › React state is preserved when navigating back/forward with links

next build failed with code/signal 1

  107 |             if (code || signal)
  108 |               reject(
> 109 |                 new Error(
      |                 ^
  110 |                   `next build failed with code/signal ${code || signal}`
  111 |                 )
  112 |               )

  at ChildProcess.<anonymous> (lib/next-modes/next-start.ts:109:17)

● back/forward cache › React state is preserved when navigating back to a page with different search params than before

next build failed with code/signal 1

  107 |             if (code || signal)
  108 |               reject(
> 109 |                 new Error(
      |                 ^
  110 |                   `next build failed with code/signal ${code || signal}`
  111 |                 )
  112 |               )

  at ChildProcess.<anonymous> (lib/next-modes/next-start.ts:109:17)

● back/forward cache › bfcache only preserves up to N entries

next build failed with code/signal 1

  107 |             if (code || signal)
  108 |               reject(
> 109 |                 new Error(
      |                 ^
  110 |                   `next build failed with code/signal ${code || signal}`
  111 |                 )
  112 |               )

  at ChildProcess.<anonymous> (lib/next-modes/next-start.ts:109:17)

● back/forward cache › navigate back and forth repeatedly between the same pages without evicting

next build failed with code/signal 1

  107 |             if (code || signal)
  108 |               reject(
> 109 |                 new Error(
      |                 ^
  110 |                   `next build failed with code/signal ${code || signal}`
  111 |                 )
  112 |               )

  at ChildProcess.<anonymous> (lib/next-modes/next-start.ts:109:17)

pnpm test test/integration/custom-page-extension/test/index.test.js

  • Custom page extension > development mode > should work with normal page (DD)
  • Custom page extension > development mode > should work dynamic page (DD)
Expand output

● Custom page extension › development mode › should work with normal page

FetchError: request to http://localhost:38287/blog failed, reason: socket hang up

  at ClientRequest.<anonymous> (../node_modules/.pnpm/node-fetch@2.6.7_encoding@0.1.13/node_modules/node-fetch/lib/index.js:1491:11)

● Custom page extension › development mode › should work dynamic page

FetchError: request to http://localhost:38287/blog/nextjs failed, reason: connect ECONNREFUSED 127.0.0.1:38287

  at ClientRequest.<anonymous> (../node_modules/.pnpm/node-fetch@2.6.7_encoding@0.1.13/node_modules/node-fetch/lib/index.js:1491:11)

icyJoseph and others added 2 commits September 29, 2025 18:09
Broken link to API Routes in Pages Router

Co-authored-by: JJ Kasper <jj@jjsweb.site>
@icyJoseph icyJoseph changed the title [backport] docs: late September improvements and fixes [backport] docs: early October improvements and fixes Oct 10, 2025
@icyJoseph icyJoseph marked this pull request as ready for review October 10, 2025 20:06
Anshuman71 and others added 6 commits October 10, 2025 13:13
### What?

Removed an extra "to"

### Why?

Semantics error/not required

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
Let's be more clear about the usage of these types.
This adds `middleware` in the routes order to clarify where it comes in
priority.
…84459)

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->

### What?

Make a note about the `$ACTION_` properties in `formData`

### Why?

Starting with next@14.1.3, `$ACTION_` properties have appeared in the
`formData`, which cause validation errors when used with a strict
validation with a library such as Zod or Yup:

```tsx
// Form Client Component
export default function Form() {
  const [state, formAction] = useFormState(action, {
    type: 'initial',
  });

  return (
    <form action={action}>
      {/* ... */}
    </form>
  );
}

// Server Action
export async function action(
  prevState: ServerActionReturnValue,
  formData: FormData,
): Promise<ServerActionReturnValue> {
  const validationResult = await schema.validate(
    Object.fromEntries(formData.entries()),
  );
```

The errors from Yup:

Errors:

- this field has unspecified keys: $ACTION_REF_1, $ACTION_1:0,
$ACTION_1:1, $ACTION_KEY
The data in the formData.entries()

```js
{
  '$ACTION_REF_1': '',
  '$ACTION_1:0': '{"id":"59f475b...","bound":"$@1"}',
  '$ACTION_1:1': '[{"type":"initial"}]',
  '$ACTION_KEY': 'k187677481',
  // Real form data starts here:
  year: '2024',
```

### How?

1. Document additional properties with keys starting with the prefix
`$ACTION_`
2. Remove the obsolete mention of `.entries()`, since that is not being
used in the code example anymore (previously, it was `const rawFormData
= Object.fromEntries(formData.entries())`)

### History

- The `$ACTION_` property change was added in
#63048
- The `docs/01-app/02-guides/forms.mdx` file was added in PR
#79288 , without the `$ACTION_`
property change

cc @delbaoliveira

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
Add missing space before "Importing Client Components" in Lazy Loading
/app docs.

This fixes the missing link in "On this page" sidebar:

<img width="1092" height="446" alt="image"
src="https://github.com/user-attachments/assets/0981467d-ad61-494d-80b2-c0a0e323dd0b"
/>

In the current state, the first link is "Skipping SSR" (second link)
instead of "Importing Client Components"

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
@icyJoseph icyJoseph merged commit 121e1b5 into next-15-5 Oct 10, 2025
134 of 140 checks passed
@icyJoseph icyJoseph deleted the next-15-5-docs-backport-1 branch October 10, 2025 20:52
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

created-by: Next.js DevEx team PRs by the DX team. Documentation Related to Next.js' official documentation. locked

Projects

None yet

Development

Successfully merging this pull request may close these issues.