Commit graph

2137 commits

Author SHA1 Message Date
조계진
b262ed0bc0
docs: fix typo in route-segment-config.mdx (#63362)
I accidentally closed [this
PR](https://github.com/vercel/next.js/pull/63307), so I opened it again.

- adjust the position of `(default)`
- change from hyphen to colon
- change the order of comments in code blocks so that the default option
`'nodejs'` comes first.
- change `nodejs`, `edge` to `'nodejs'`, `'edge'` like other string
segment options.

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-17 19:38:29 +00:00
Sol Lee
0ab8c20978
docs: Make a better sentence by connecting with comma (#63355)
This PR makes a grammatical improvement for a sentence in the
documentations page
(https://nextjs.org/docs/app/building-your-application/routing/pages-and-layouts)

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-17 19:35:55 +00:00
Steven
02a06175e3
feat: add deploymentId config (#63198)
This PR stabilizes an experimental feature that was added in a previous
PR https://github.com/vercel/next.js/pull/50470

It allows the user to set `deploymentId` in `next.config.js`, which is a
unique identifier for a deployment that will be included in each
request's query string or header.

This PR is easier to review with whitespace hidden:
https://github.com/vercel/next.js/pull/63198/files?w=1

Closes NEXT-2789
2024-03-13 16:46:50 -04:00
michaltarasiuk
6cbab35e50
Update 02-server-actions-and-mutations.mdx - add required generic type and remove unnecessary parameter types (#62551)
- Resolve generic type issue: "Expected 1 argument, received 2."
- Types in the reducer are automatically inferred.

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-13 19:14:29 +00:00
michaltarasiuk
de5ea0fae9
Update 02-server-actions-and-mutations.mdx - FormData is itself iterable (#62541)
FormData objects are iterable, so we can get entries directly without
the need for calling .entries().

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-13 18:26:38 +00:00
Jiwon Choi
d60bcc0c00
docs: replace vercel/otel link (#63173) 2024-03-12 22:16:47 -05:00
CD
db9e345ae2
Update route.mdx (#60976)
Added correction to docs referencing access to parameters in routes. It
should be context.params.team as opposed to params.team.
 
I've also added typescript example for this case just in case anyone
needs it.
2024-03-13 00:58:40 +00:00
Sam Ko
68206c986d
docs(link): add good to know comment about scroll behavior (#63152)
## Why?

We need to clarify that we are scrolling to the top of `{children}` when
it is not shown in the current viewport.

Closes NEXT-2780

---------

Co-authored-by: Zack Tanner <zacktanner@gmail.com>
2024-03-11 13:37:09 -07:00
Landon Colburn
cc57fe850d
Fixed Authentication docs improper nesting of unordered list inside ordered list (#62958)
On the Building Your Application: Authentication page, the formatting is
broken in the "Setting Up Middleware" section because the unordered list
is nested inside the ordered list. This is causing the unordered list
components to be numbered and throw off the ordering of the top level
list.

I made a tiny change to the markdown to make the top level steps h4
titles, and un-nested the unordered list's

Closes NEXT-61838
Fixes #61838

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-11 19:47:47 +00:00
Tim Afanasiev
1cb16f878c
Joy-UI supports Next.js (#63144)
As stated
[here](https://mui.com/joy-ui/integrations/next-js-app-router/), Joy UI
supports Next.js integration.
2024-03-11 16:35:55 +00:00
Lee Robinson
e148eac4a8
docs: clarify perf benefits of RSC (#63096)
Source: https://twitter.com/AnthonyPAlicea/status/1766262535026606134
2024-03-10 19:49:46 -05:00
Dima Voytenko
b8d63702f3
OTEL: add next.rsc attribute for RSC requests (#63074)
`next.rsc: boolean` attribute to indicate whether it's a RSC request
2024-03-08 21:58:00 -08:00
Karl Horky
47b466865b
Docs: Note $ACTION_ formData properties (#63048)
<!-- 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

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### 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?

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

### Why?

Since `next@14.1.3`, some new `$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?

Document additional properties with keys starting with the prefix
`$ACTION_`

### Alternatives Considered

Maybe these `$ACTION_` properties are not intended to be exposed to
users, and should be stripped before the `formData` reaches the Server
Action.

### Related

The documentation was originally introduced in commit
[`687239c`](687239ce76),
which was a part of this PR:

- https://github.com/vercel/next.js/pull/59080

cc @delbaoliveira

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-08 23:05:14 +00:00
Austin Riba
a767aa8713
Fix typo in 03-environment-variables.mdx (#63067)
making -> meaning.

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-08 13:44:18 -08:00
Anthony Shew
de5d1c3fed
Details for Turbopack loaders. (#62300)
### What?

Bringing Turbopack for Next.js documentation from `turbo.build` to
`nextjs.org/docs`.

> Note: After this PR lands, there will be a subsequent PR to
`vercel/turbo` to remove these docs from `turbo.build` and redirect
here.

### Why?

Previously, this documentation was on `turbo.build`. This was confusing
because these docs weren't specific to Next.js. Rather, they are for
Next.js developers who want to configure their bundler (which happens to
be Turbopack under the hood).

We had seen a number of times that folks were unable to find loader and
configuration support for the their Next.js + Turbopack applications so
this PR should help surface that information better where folks are
looking for it.

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-03-08 13:35:27 -08:00
Balázs Orbán
31a3aff755
docs: Update route-segment-config.mdx (#63046)
Fix a broken link

Closes NEXT-2761
2024-03-08 10:26:56 -05:00
Delba de Oliveira
c07f872169
docs: Update CRA migration guide (#63037) 2024-03-08 08:56:45 -06:00
nauvalazhar
2598ec8c1e
docs: change the Router Cache link reference (#62976)
<!-- 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

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### 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?

Currently, the Router Cache on the [Linking and
Navigating](https://nextjs.org/docs/app/building-your-application/routing/linking-and-navigating)
page is linked to the "[Data Fetching, Caching, and
Revalidating](https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#caching-data#router-cache)"
page, isn't it would be more accurate if Router Cache referenced to the
[Router Cache section on the
Caching](https://nextjs.org/docs/app/building-your-application/caching#router-cache)
page instead?

### Why?

This change would avoid confusion in two ways:
1. The first link used in the Linking and Navigating page does not exist
(https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#caching-data#router-cache)
2. Router Cache on the Caching page offers specific context and a
detailed guide on the topic

Thank you.

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-07 22:13:50 +00:00
Delba de Oliveira
446083e21a
Docs: Document crossOrigin option (#61455) 2024-03-07 12:24:04 -06:00
Delba de Oliveira
c1aa8ddfd6
Docs: Clarify AbortController.signal usage in React fetch memoization (#63009)
As per @SukkaW's feedback. Closes:
https://linear.app/vercel/issue/DX-2379/clarify-abortcontrollersignal-usage-in-react-fetch-memoization
2024-03-07 12:08:37 -06:00
lhfmartin
c9cf8b9537
Fix syntax error in the TypeScript example (#63003)
### What?
Missing comma to separate dict entries

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-03-07 16:50:13 +00:00
Delba de Oliveira
e93472e7d1
Docs: Clarify fetch caching exceptions (#63004)
Clarify that fetch is not cached when used in a Server Action (see
https://github.com/vercel/next.js/pull/60170), and in `POST` requests in
Route Handlers.
2024-03-07 10:01:43 -06:00
Balázs Orbán
6b111ec6d3
docs: sync serverComponentsExternalPackages.mdx with implementation (#62966)
I noticed in #62965 that these were out-of-sync.

Content should match:
https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/server-external-packages.json

Also sorted alphabetically.

Closes NEXT-2732
2024-03-06 16:27:24 -08:00
James Mikrut
a1e294b706
Remove Payload from server-external-packages.json (#62965)
Payload is moving to ESM, and we need to be removed from the default
list of `serverComponentsExternalPackages`.

This PR simply removes Payload from the default list. Developers can add
it back in if they are using older versions of Payload.

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-03-06 15:52:40 -08:00
Sam Ko
e9cc67df61
docs(cli): add mention of our default port behavior (#62964)
## Changes

- We need to document how that we retry until a port is found when we're
not specifying a port via the CLI (`--port`) or the `PORT` environment
variable. For example, if `3000` and `3001` are used, we will check
`3000`, `3001`, and then land on `3002`.

Closes NEXT-2731
2024-03-06 14:57:29 -08:00
Eleni Stavropoulou
41cb6c488d
[docs] Fix the TS Type from the function sitemap #62947 (#62960)
Closes https://github.com/vercel/next.js/issues/62947

This PR fixes the TS Type from the function sitemap.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-03-06 20:35:13 +00:00
KaygNas
47380b1080
Add missing await keyword in code block. (#62919)
### Improving Documentation

Add missing `await` keyword in code block.

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-06 19:13:16 +00:00
Ryan Halliday
78e7ddd0f2
Update 06-src-directory.mdx to mention Typescript paths (#62863)
Small update to mention TS paths when changing to src/ directory as it
is something most users will need to do.

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-05 19:37:20 +00:00
Dev
5001da0ed0
Update sitemap.mdx (#62809)
<!-- 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

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### 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 #

-->
2024-03-04 15:13:24 -08:00
Lee Robinson
1d00ed4bf1
docs: clarify client component intro (#62767)
"Render on the client" could sound like client-only rendering.
2024-03-02 16:39:04 -06:00
Sam Ko
ccbd69ff9a
docs: update Next.js CLI docs (#62304)
## Description

It made sense to improve our <picture data-single-emoji=":nextjs:"
title=":nextjs:"><img class="emoji" width="20" height="auto"
src="https://emoji.slack-edge.com/T0CAQ00TU/nextjs/2a85d633ae594556.png"
alt=":nextjs:" align="absmiddle"></picture> CLI docs after refactoring
the CLI!

## Important Changes
- Removes mention of `next export`, which was moved to `next.config.js`
- Adds mention of `--turbo`
- Adds all the expected help outputs

## Related
- https://github.com/vercel/next.js/pull/61877
- Fixes https://github.com/vercel/next.js/issues/59226

Closes NEXT-2545

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
Co-authored-by: Michael Novotny <manovotny@gmail.com>
Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-03-01 15:13:08 -08:00
Wes Bos
b1089d3691
Update unstable_cache docs for revalidate option (#62689)
Clarifies what passing false or undefined to the revalidate property
option of unstable_cache does.

Context: I didn't want my DB query to be cached at all, but I did use
this API because I wanted to refresh a component's data after submitting
a server action. I thought I had to pass 0, or false to get it to not
cache at all.

Co-authored-by: Sam Ko <sam@vercel.com>
2024-02-29 19:49:15 +00:00
Spencer Zeng
24b7175dcf
Correct format for autoplay attribute in NextJS video docs (#62695)
### What?
Updates the format of the `autoplay` attribute in the [videos
documentation](https://nextjs.org/docs/app/building-your-application/optimizing/videos#common-video-tag-attributes)
to camel case, which is the correct format for the attribute in JSX,
matching the format of `playsInline`.

Co-authored-by: Sam Ko <sam@vercel.com>
2024-02-29 19:27:09 +00:00
Soheil Jafarnejad
c353b5f0e6
Update 05-error-handling.mdx (#62153)
The global error boundary is only displayed in the production (prod)
environment and is not shown in the development (dev) environment.

<!-- 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

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### 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 #

-->

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-02-28 17:55:05 -08:00
Jimmy Chion
8c242ac095
[docs] update analytics doc to use useReportWebVitals (again) (#62654)
Closes #62653

Finishes the job started by https://github.com/vercel/next.js/pull/58196
and updates the last remaining code example that uses `reportWebVitals`
to use `useReportWebVitals`

Co-authored-by: Sam Ko <sam@vercel.com>
2024-02-28 15:19:01 -08:00
Avery Morin
eb0bd561a9
docs: Don't suggest using taintUniqueValue API with phone number (#62600)
Linked react docs explicitly advise not to use low-entropy values such
as phone numbers with the taintUniqueValue API.
https://react.dev/reference/react/experimental_taintUniqueValue#caveats

> Do not use taintUniqueValue to protect low-entropy values such as PIN
codes or phone numbers. If any value in a request is controlled by an
attacker, they could infer which value is tainted by enumerating all
possible values of the secret.

PS Sorry for the tiny change but this threw me off when I read it.
2024-02-27 16:28:05 -05:00
Balázs Orbán
f82a6e187a
docs: fix redirect loop in auth code example (#62589)
### What?

If the user is logged in and on the dashboard, no need to redirect.

### Why?

#62547

### How?

We still want to redirect to the dashboard from other routes, if the
user is logged in already.

Fixes #62547, also related #62548

Closes NEXT-2619
2024-02-27 15:35:59 -05:00
Ye Zhu
0d1b11fba3
docs: Remove superfluous <PagesOnly> tags in api-reference/components/link.mdx (#62501)
Within the document
[docs/02-app/02-api-reference/01-components/link.mdx](https://github.com/zhuyedev/next.js/blob/canary/docs/02-app/02-api-reference/01-components/link.mdx#L327),
there is an unnecessary set of `<PagesOnly>` tags, which prevents a few
sections from being displayed correctly.This issue particularly affects
the section starting with "### If the child is a custom component that
wraps an <a> tag" (in line 327) and ending just before "### Middleware"
(in line 458).

Co-authored-by: Sam Ko <sam@vercel.com>
2024-02-26 17:20:41 +00:00
JINSOUL KIM
7727c5c411
docs: fix typo (#62543)
### What?
I found a small typo in the docs.(analytics.mdx)
Missing ")" in the end of function.

### How?
Add ")" in the end.

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-02-26 16:15:40 +00:00
bestlyg
0f4e3eeece
docs: update app router link (#62533) 2024-02-26 09:03:47 -06:00
bestlyg
e98978033f
feat(docs): update 14-internationalization.mdx (#62484)
### Improving Documentation

follow the
[example](https://github.com/vercel/next.js/blob/canary/examples/app-dir-i18n-routing/middleware.ts#L53),
it is better to use NextResponse instead of Response.
2024-02-24 15:11:19 +00:00
Delba de Oliveira
01c1bfa325
Docs: Add CORS examples (#62439) 2024-02-23 09:11:57 -06:00
Masato Nakamura
946c15fb2c
chore: Bump actions/cache (#62422)
<!-- 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

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### 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 #

-->

GitHub is [planning to upgrade to Node
20](https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/).
Versions prior to actions/cache v3 use an outdated version of node, so
we will upgrade to actions/cache v4, where [Node 20 is the
default](https://github.com/actions/cache/releases/tag/v4.0.0).

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-02-23 08:05:17 +00:00
Sam Ko
ad48047beb
docs(link): update docs around link prefetch: false (#62414)
## Changes

Better clarify the differences between App and Pages Router around
`prefetch: false`.

Closes NEXT-2575
2024-02-23 01:34:25 +01:00
Jiwon Choi
5a4b56fb0f
chore(docs): mention that next.config.js must have default export (#62341)
### What?

When the next config has no default export, it does not inform the user
correctly, but as:

```ts
// next.config.mjs

/** @type {import('next').NextConfig} */
export const config = {
  // ...
}
```

```sh
⚠ Invalid next.config.mjs options detected: 
⚠     Unrecognized key(s) in object: 'config'
⚠ See more info here: https://nextjs.org/docs/messages/invalid-next-config
```

### Why?

The options within the named exported config may be inactivated without
notice.

### How?

Since we use dynamic import for the config, check if `userConfigModule`
has a `default` export, and if not, throw an error.
Also, added to the docs to address by text that the config needs a
default export.
2024-02-22 15:37:13 -05:00
Mehran Farahani
0b346c28bc
docs: add current state argument to authenticate function (#62399)
### What?
Added a `_currentState` argument to the `authenticate` function in the
'Building Your Application' authentication documentation.

### Why?
The `useFormState` hook's first argument is a function that requires two
arguments. This adjustment ensures the `authenticate` function aligns
with the expected structure used by `useFormState`. For more details,
refer to the React documentation: [useFormState
Hook](https://react.dev/reference/react-dom/hooks/useFormState).
2024-02-22 19:24:41 +00:00
Colby Fayock
f2c2b0d0fe
Updating Cloudinary Video Resources (#61959)
### What?

Updates the Cloudinary bullets and links under the Video Optimization.


https://nextjs.org/docs/app/building-your-application/optimizing/videos#cloudinary-integration

### Why?

More relevant direct link to the Cloudinary-supported Next.js SDK along
with an additional link to the Video solution itself.

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-02-22 19:01:01 +00:00
John Slemmer
e42fadacbf
better reference for what is serializable by React (#62405)
The current link just takes you to the definition of serialization on
MDN. I'm proposing this should link to the React docs and what they are
able to serialize because it is way more than JSON.
2024-02-22 19:00:36 +00:00
Svetoslav99
e722778768
docs: fix web-vitals.tsx file path for second example (#62387)
Changing from "components" to "_components" folder name here
"app/components/web-vitals.tsx", to be the same as previous example on
the page "app/_components/web-vitals.tsx".

Co-authored-by: Steven <steven@ceriously.com>
2024-02-22 16:54:11 +00:00
suu3
9feaffaf68
docs: add an explanation about prefetch on hover to the link.mdx (#62182)
<!-- 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

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### 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 #

-->

Hello, I noticed the following code in `link.tsx`.
```
//client/link.tsx
...
onMouseEnter(e) {
    ...
    if (
        (!prefetchEnabled || process.env.NODE_ENV === 'development') &&
        isAppRouter
    ) {
        return
    }

    prefetch(
          ...
    )
},
```
It seems that when prefetch={false} is set, prefetch still occurs on
hover for page routers.
However, there is no explanation in the <Link> documentation, which
caused misleading.
I added the explanation inside PageOnly component, could you please
review it?
2024-02-21 05:56:07 +00:00