Commit graph

2333 commits

Author SHA1 Message Date
Delba de Oliveira
38850bf1ee
Docs: Instructions on how to generate turbopack trace file (#64325)
Co-authored-by: Balázs Orbán <info@balazsorban.com>
2024-04-11 11:55:18 +02:00
Tim Neutkens
c976ca6ec5
Update documentation on webpack loaders in Turbopack (#64296)
## What?

Updates the loader documentation to the format.

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

-->


Closes NEXT-3061
2024-04-10 17:02:55 +02:00
Martin Goutry
e1e3332b17
chore(docs): update wrong route in staleTimes.mdx (#64278)
This fixes a wrong route in the
[staleTimes](https://nextjs.org/docs/app/api-reference/next-config-js/staleTimes)
doc

Co-authored-by: Sam Ko <sam@vercel.com>
2024-04-10 04:07:37 +00:00
Ahsan Moin
90b3ddd671
chore: fix some typos (#64276)
`functionaility` -> `functionality`
`programatically` -> `programmatically`
`recored` -> `record`
`specfy` -> `specify`

<!-- 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-04-10 04:04:52 +00:00
Sam Ko
5ee8c4bd3f
docs(cli): re-order profile to match help output (#64267)
## Why?

Forgot to add this change in here →
https://github.com/vercel/next.js/pull/64264.

Closes NEXT-3055
2024-04-09 18:18:58 +00:00
Zack Tanner
85b9ed5eb8
provide revalidateReason to getStaticProps (#64258)
Provides a `revalidateReason` argument to `getStaticProps` ("stale" |
"on-demand" | "build").

- Build indicates it was run at build time
- On-demand indicates it was run as a side effect of [on-demand
revalidation](https://nextjs.org/docs/pages/building-your-application/data-fetching/incremental-static-regeneration#on-demand-revalidation)
- Stale indicates the resource was considered stale (either due to being
in dev mode, or an expired revalidate period)

This will allow changing behavior based on the context in which it's
called.

Closes NEXT-1900
2024-04-09 09:53:08 -07:00
Steven
8c9c1d2b6d
feat(next/image): add overrideSrc prop (#64221)
- Fixes https://github.com/vercel/next.js/discussions/60888
- Related
https://merj.com/blog/optimising-nextjs-image-component-for-image-search
2024-04-09 10:48:01 -04:00
Jiachi Liu
5e2ac0986f
chore: externalize undici for bundling (#64209)
Currently acornjs has an issue with compiling undici, add undici
externalize, once it's resolved we can remove the externalization for it

```
You may need an additional loader to handle the result of these loaders.
|       // 5. If object is not a default iterator object for interface,
|       //    then throw a TypeError.
>       if (typeof this !== 'object' || this === null || !(#target in this)) {
|         throw new TypeError(
|           `'next' called on an object that does not implement interface ${name} Iterator.`

Import trace for requested module:
../../../../node_modules/.pnpm/undici@6.12.0/node_modules/undici/lib/web/fetch/util.js
../../../../node_modules/.pnpm/undici@6.12.0/node_modules/undici/lib/web/fetch/headers.js
../../../../node_modules/.pnpm/undici@6.12.0/node_modules/undici/index.js
./app/undici/page.js
```

Closes NEXT-3030
2024-04-09 07:26:53 +00:00
HyunJick Lee
baaca4b69e
fix(docs): update width height value on example to sync with demo (#64147)
I'm looking at the example code and demo for the Image component, 
[Responsive image using a static
import](https://nextjs.org/docs/app/api-reference/components/image#responsive-image-using-a-static-import)
and [Responsive image with aspect
ratio](https://nextjs.org/docs/app/api-reference/components/image#responsive-image-with-aspect-ratio)
sections are immersive because the code in the example and the demo
match, The [Responsive image with
fill](https://nextjs.org/docs/app/api-reference/components/image#responsive-image-with-fill)
section breaks the immersion because the code in the example and the
demo are slightly different.

I think it's just a typo. It seems the width and height values are
reversed.

Attach the code from the demo.

<img width="504" alt="Responsive image with fill demo code"
src="https://github.com/vercel/next.js/assets/56260102/72ab314d-a9b3-4a88-8d9c-48f0dde8c19f">

Co-authored-by: Steven <steven@ceriously.com>
2024-04-08 22:15:03 +00:00
Tim Neutkens
c9f3813402
Add additional links to staleTime docs (#64195)
## What?

Few more links for relevant concepts.

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

-->


Closes NEXT-3027
2024-04-08 15:52:48 +02:00
Lee Robinson
436264ffbc
docs: add note about streaming and Safari limitations (#64179)
https://bugs.webkit.org/show_bug.cgi?id=252413

---------

Co-authored-by: Steven <steven@ceriously.com>
2024-04-08 07:38:44 -05:00
DevMirza
a42efae49d
fix: Update install method for Bun (#64151)
<!-- 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?
So, i was trying to create a Next.js project with Bun as i was
experimenting with it and i got error creating the project `error: could
not determine executable to run for package create` so i added `-` after
create and works and created by project successfully.

## Before


![image](https://github.com/vercel/next.js/assets/53424436/d27fd404-c462-4fc7-aa06-a1743f57d551)

## After

![image](https://github.com/vercel/next.js/assets/53424436/3804735f-3b59-4dac-a97e-672a533a38be)

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-04-07 09:41:32 -07:00
Mehdi
a1e5d0b06d
chore: Replaced more impactful words (#63835)
That's it, and about the metadata (description), I had to change it
cause it feels like the new change can be more relatable on the
[MDX](https://nextjs.org/docs/app/building-your-application/configuring/mdx)
page.

---------

Co-authored-by: samcx <sam@vercel.com>
2024-04-05 20:04:11 +00:00
Alexander
027d7ab186
docs: fix code snippet in next/script (#64119)
Removed unintended use of `PagesOnly` component inside a code block.
2024-04-05 17:12:12 +00:00
Zack Tanner
5c29e931dc
docs: add experimental staleTimes resource (#64040)
This documents the behavior introduced in #62856 to allow globally
overriding the router cache invalidation period.

`static` and `dynamic` in this case refer to variable levels of
"liveness" and are unrelated to whether the segment itself is opting
into static or dynamic rendering. In other words, the current `dynamic`
default of 30s suggests that we consider the 30s delta to feel dynamic
while still providing some caching for performance reasons. Others might
prefer a value of 0s here, hence the configuration.

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

-->


Closes NEXT-2995
2024-04-04 14:58:29 -07:00
Kavikumar M
2ab4a443a2
fix the command to install nextjs using bun (#64081)
the correct installation command for nextjs using bun is " bunx create
next-app " not bunx create-next-app

I've changed it to correct command.
2024-04-04 18:16:04 +00:00
Zack Tanner
00d9c581eb
docs: fix prefetching information (#64039)
The docs make a distinction between prefetch behavior based on
static/dynamic data but this is not how it's implemented. The correct
heuristic is based on the `prefetch` prop. The original PR describing
this behavior can be found in #48383.

This clarifies how the prefetch prop influences the invalidation period,
and how `loading.js` influences the prefetch response.

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

-->


Closes NEXT-2994
2024-04-04 07:57:38 -07:00
Eunkyung-Son
adccea6f72
docs: fix sitemap code snippet typo (#64061) 2024-04-04 09:18:32 -05:00
Zack Tanner
dbd66e478f
docs: fix dynamic searchParams copy (#64038)
Fixes a typo related to how using `searchParams` opts into dynamic
rendering.

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

-->


Closes NEXT-2993
2024-04-03 11:22:08 -07:00
Nicolai Calinin
d93e68fbb8
"const loginSegment =" should be singular (#64029)
"const loginSegment=" should be singular, because there is
**useSelectedLayoutSegment** in the example, not
**useSelectedLayoutSegments**

<!-- 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: JJ Kasper <jj@jjsweb.site>
2024-04-03 10:11:44 -07:00
mknichel
fbfd1b27da
Fix the command to run next build with Node.js --heap-prof flag (#63982) 2024-04-02 14:25:12 -04:00
Youngseop Bae
1e44a52d64
[docs] aria-disabled does not disabled button. (#63888)
<!-- 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 #

-->

I fixed #63887 .

I saw this PR (#63852) and follow-up suggestion and modified the example
to be clearer

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-03-31 11:47:24 -07:00
Cameron
ff1db77f1b
change aria-disabled on form buttons to disabled (#63852)
- aria-disabled does not disable the button

<!-- 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: JJ Kasper <jj@jjsweb.site>
2024-03-29 11:45:02 -07:00
mknichel
c9439b5654
Adds documentation on optimizing memory usage (#63689) 2024-03-28 23:28:09 -05:00
Jiwon Choi
749c8e7279
docs: add details about images options at next.config.js options (#63712)
Since the [image configuration
options](https://nextjs.org/docs/app/api-reference/components/image#configuration-options)
have all the necessary options for `images` that need to be addressed in
the [next.config.js
options](https://nextjs.org/docs/app/api-reference/next-config-js/images),
we refer to them without making significant changes.

Also, `use client` is required to use the `loader` option in the App
Router but not Pages.

Closes #62793

---------

Co-authored-by: Steven <steven@ceriously.com>
2024-03-29 01:49:11 +00:00
JJ Kasper
72ef9d9431
Add note about data cache not applying middleware (#63842) 2024-03-28 23:49:46 +00:00
Tim Neutkens
98e6fc5820
Update Turbopack docs (#63759)
## What?

Same as #63729. That branch was restacked strangely by the Graphite CLI.

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

-->


Closes NEXT-2948

---------

Co-authored-by: Anthony Shew <anthonyshew@gmail.com>
2024-03-27 12:15:28 +01:00
Ivo Biaus
d1d29cc263
Update default.mdx (#63678)
Corrected the indicated URL, since based on the image it's referring to,
there is no "dashboard" parent folder around settings.
Image of reference:

![image](https://github.com/vercel/next.js/assets/43274372/337bf077-4cb6-4900-8f29-6af506097078)
2024-03-26 22:33:44 +00:00
Stephanie Dietz
b0843fea26
Update middleware docs to include common use cases (#63534) 2024-03-25 14:56:48 -05:00
JJ Kasper
cf9e647f41
Auto map optimizePackageImports to transpilePackages for pages (#63537)
This ensures `optimizePackageImports` doesn't unexpectedly fail to apply
for `pages` as they aren't transpiled/bundled by default without either
`transpilePackages` being used or `experimental.bundlePagesExternals`.
This also ensures our docs correctly show this config in the pages docs
as currently in only shows in `app`.

x-ref: [slack
thread](https://vercel.slack.com/archives/C0676QZBWKS/p1710967294942029)

Closes NEXT-2884
2024-03-25 12:17:02 -07:00
Eng Zer Jun
3ba3eeb2a2
Remove obsolete block-all-mixed-content CSP directive (#63595)
The `block-all-mixed-content` CSP directive has been deprecated and it
is not recommended to use it anymore.

Furthermore, the `upgrade-insecure-requests` directive is evaluated
before `block-all-mixed-content`, if the former is set, the latter does
nothing.

Reference:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/block-all-mixed-content
Reference: https://www.w3.org/TR/mixed-content/#strict-checking

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-03-25 10:09:17 -07:00
Yamagishi Kazutoshi
9244100e39
Fix documentation of supported JS Features (#63640)
### What?

Class Fields and Static Properties are already included in ES2022, not
in the proposal.

Co-authored-by: Steven <steven@ceriously.com>
2024-03-25 13:29:43 +00:00
nauvalazhar
44917cf234
docs: async is missing in a server component (#63661) 2024-03-25 11:37:40 +01:00
tang
142b48f35c
Update 10-custom-server.mdx (#63543)
Add description that custom servers cannot be applied to standalone
output mode

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Steven <steven@ceriously.com>
2024-03-22 14:40:10 +00:00
이동현
3a1be97fed
chore(docs): update React docs link (#63594) 2024-03-22 14:35:58 +00:00
Tim Neutkens
66be631d8a
Remove lodash from external packages list (#63601)
## What?

Since the work that Shu did for optimizing large barrel dependencies
marking lodash as external is no longer required.

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

-->


Closes NEXT-2899
2024-03-22 10:56:38 +00:00
JJ Kasper
00bcd55163
Update middleware matcher docs to mention has matching (#63533)
Looks like we were only documenting the `missing` matcher use case
although `has` is also supported and we weren't mentioning they can
combined as well.

x-ref: [slack
thread](https://vercel.slack.com/archives/C06LDQYNPV0/p1710704436247789)

Closes NEXT-2883

---------

Co-authored-by: Zack Tanner <zacktanner@gmail.com>
2024-03-20 20:53:39 +00:00
Juan Settecase
e4cd547a50
feat: add support for localizations in sitemap generator (#53765)
### What?

Following up with [this
suggestion](https://github.com/vercel/next.js/discussions/53540) I went
ahead and implemented the proposal for the Next.js team to merge it if
they agree.

Things to keep in mind:
- Google has [three different
ways](https://developers.google.com/search/docs/specialty/international/localized-versions#methods-for-indicating-your-alternate-pages)
to do this. The three of them are equivalent
- Google seems to be the only search engine supporting this approach.
The rest of them should ignore it

### Why?

This is supported by
[Google](https://developers.google.com/search/docs/specialty/international/localized-versions#example_2)
to better understand the site when the same page is available in
multiple languages.

### How?

- I added a new key to the `MetadataRoute.Sitemap` type called
`alternates` which accepts just one sub key `languages` similar to the
current one in the
[Metadata](https://nextjs.org/docs/app/api-reference/functions/generate-metadata#alternates)
object
- I updated the `resolveSitemap` method to process the new key and
generate the expected sitemap
- I updated the related tests and documentation to reflect the new
syntax

---------

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2024-03-20 17:00:20 +00:00
Rafael Fernandes
14a653bfab
Update opentelemetry docs #63443 (#63444)
Fix #63443 

- Change deprecated semanticResourceAttributes.SERVICE_NAME for
SEMRESATTRS_SERVICE_NAME

<!-- 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-03-19 21:54:54 +00:00
LuiGeeDev
2bb65cabdb
Update a third-parties docs, GoogleTagManager example (#63448)
### What?
If I follow the example in docs then use GTM, it doesn't work when I
send an event in page when mounted using useEffect. It logs a warning:
`@next/third-parties: GTM dataLayer dataLayer does not exist`

### Why?
`window.dataLayer` does not exist when children is rendered, because
children runs faster than GoogleTagManager component. It works in dev
mode, but doesn't work when built, so it can be easily missed.

### How?
It works fine when the order is changed. As you see in example,
GoogleTagManager should come first, higher than children.
2024-03-19 21:43:49 +00:00
Chris Stott
198e2d79d2
Update generate-viewport.mdx (#63493)
Updates inaccurate wording that says the following example contains the
default configuration. I did this rather than update the example because
the [default
configuration](https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/metadata/default-metadata.tsx#L9)
does not set all values, so it seems useful that the example documents
all of them.

(By the way, the configuration in the example violates accessibility
standards by setting `userScalable: false` and `maximumScale: 1`, which
is what caught my eye in the first place. Glad to find out that it
wasn't the actual default)
2024-03-19 20:54:57 +00:00
JJ Kasper
b2b5ab4aff
Update tags limit handling for max items (#63486)
Continuation of https://github.com/vercel/next.js/pull/55083 this
ensures we also properly warn when the max number of tags is hit and we
must filter them out so that users are aware of this. Related
documentation is also updated to reflect this limit.

x-ref: [slack
thread](https://vercel.slack.com/archives/C04V3E1UYNQ/p1710792129356939)

Closes NEXT-2870

---------

Co-authored-by: Steven <steven@ceriously.com>
2024-03-19 12:02:35 -07:00
piotrekwitkowski
05c0be3f49
docs: add AWS CloudFront loader for next/image (#63262)
### What?
Adds Amazon CloudFront custom loader docs.

### Why?
Help people find Amazon CloudFront as an option for Image loaders.

---------

Co-authored-by: Steven <steven@ceriously.com>
2024-03-19 18:15:27 +00:00
Konrad Pettersson
a8b88b7605
Rename variable in documentation example (#63425)
Rename variable `cookieList` to `cookieStore` in [documentation
example](https://nextjs.org/docs/app/api-reference/functions/cookies#cookieshasname)
to be aligned with every other example in the same page
([here](51b878f5a3/docs/02-app/02-api-reference/04-functions/cookies.mdx (L23))
and
[here](51b878f5a3/docs/02-app/02-api-reference/04-functions/cookies.mdx (L37))
compared to
[here](51b878f5a3/docs/02-app/02-api-reference/04-functions/cookies.mdx (L55)))
I see no deliberate reason the [third
example](51b878f5a3/docs/02-app/02-api-reference/04-functions/cookies.mdx (L51-L59))
should differ from the rest.

Co-authored-by: Steven <steven@ceriously.com>
2024-03-18 19:50:52 +00:00
Jiachi Liu
049d127e91
docs: fix next/script example causing hydration errors (#63401)
Related #51242 

React will error `In HTML, <script> cannot be a child of <html>. This
will cause a hydration error.` when `script` is rendered under `html`
directly. The examples in our docs are causing this hydration error.
Moving it under `body` tag will fix the hydration error

Closes NEXT-2834

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-03-18 14:36:23 +00:00
Robin Wieruch
bbd3543af4
docs: add Lucia for authentication (#63339)
I used Lucia in my last App Router project and it was a super smooth
experience. I would have put it on top of the list, because it is open
source, you keep your user data, it is not a paid service, and has no
lock-in, however, I though I would have to put it below Clerk, because
Clerk is official Vercel partner (?). Anyway, would love to see Lucia in
the list!

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-17 19:46:25 +00:00
조계진
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
Nick Muller
1783e55c28
Fix typo in unstable_cache.mdx (#62301) 2024-02-20 22:25:20 +00:00
Cody Lundquist
fb99d2eaf5
docs: Update unstable_cache.mdx with important info about dynamic data (#62202)
<!-- 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?

This caused me a ton of issues in production due to inconsistent cache.
It does not manifest itself in local development. The only reason I
figured it out was because I upgraded to the canary release and someone
added a helpful exception explaining that I shouldn't be doing what I
was doing. To hopefully help people in the future, I'm adding a blurb to
the `unstable_cache` docs.

Co-authored-by: Sam Ko <sam@vercel.com>
2024-02-20 17:52:53 +00:00
Balázs Orbán
0d64d592f4
docs(cli): tweak next info docs (#62274)
### What?

Follow-up on #62249

### Why?

I noticed the example `next info` output was outdated/missing a few
parts in the docs.
2024-02-20 09:55:49 -05:00
Tobias Koppers
8250a8419a
add turbo.resolveExtensions to allow to customize extensions (#62004)
### What?

* add `turbo.resolveExtensions` to allow to customize extensions in
Turbopack

fixes PACK-2335
Fixes https://github.com/vercel/turbo/issues/4934
2024-02-19 09:07:09 +00:00
ArianHamdi
ab487cba92
docs: fix page.js file name in 02-pages-and-layouts.mdx (#62221)
<!-- 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-19 03:22:24 +00:00
Theo
d18335ba43
Fix 02-pages-and-layouts.mdx to show Good to know and contents in the same box (#62203)
**Good to know:** and list should be inside the same box.


![image](https://github.com/vercel/next.js/assets/36564257/072eb7ca-1c95-473b-9d08-c4cea649b7ea)


<!-- 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-02-17 22:39:18 +00:00
Ismail Ghallou
ef1fb15260
docs: fix srclang prop (#62164)
### What?
- `srclang` -> `srcLang`

### Why?
React.js!
2024-02-16 19:47:16 +00:00
kevinmitch14
d397832e01
Docs: update link.mdx (#61508)
Updated paths in relation to `<Link />` and middleware rewrites. Feel
free to leave suggestions if needed, this has always confused me a
little bit.

**Old Version**:
For example, if you have a Dynamic Route like `/dashboard/[user]` that
you want to present differently via middleware, you would write: `<Link
href={{ pathname: '/dashboard/authed/[user]', query: { user: username }
}} as="/dashboard/[user]">Profile</Link>`.

The `as` prop should be the URL we want to display while href/pathname
is the actual path. So if we want to present something differently via
middleware, we would do so via `as`. In the example above we want to
display `/dashboard/[user]` differently but we use
`as='/dashboard/[user]'`.
2024-02-16 19:43:11 +00:00
Bernardo Belchior
f23f57f692
Fix extra const in video docs (#62155)
<!-- 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: JJ Kasper <jj@jjsweb.site>
2024-02-16 18:26:06 +00:00
Phil Z
5f98a8def0
Add puppeteer-core to serverComponentsExternalPackages.mdx (#62156)
<!-- 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 #

-->

This is a docs change that I should have included with
https://github.com/vercel/next.js/pull/62063

Adds `puppeteer-core` to the documented list of external server
dependencies to be ignored by the bundler.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-02-16 18:25:16 +00:00
Lee Robinson
c48a0f8e6d
docs: add link to Blob (#62056) 2024-02-14 11:06:47 -05:00
Alex Puertas
898f74e729
docs: update Auth.js name to NextAuth.js (#61974)
On the Examples section the name was already updated but not updated on
the Selecting Session Management in Next.js

---------

Co-authored-by: Balázs Orbán <info@balazsorban.com>
2024-02-13 12:32:36 +01:00
Balázs Orbán
65517ac621
chore: fix lint (#61950)
Fixes linting issue from #61934

Closes NEXT-2442
2024-02-12 16:32:20 +00:00
Rajdeep singh
1c64850360
docs: add missing closing curly brace to code snippet (#61934)
Closed the missing `}` in the [Theme Detection
Picture](https://nextjs.org/docs/app/api-reference/components/image#theme-detection-picture)
example code.

---------

Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: Balázs Orbán <info@balazsorban.com>
2024-02-12 17:26:23 +01:00
Hong
eb03ae742f
docs: fix typo (#61943)
### Why?
`compatability` is not a correct word.

### How?
Use `compatibility` instead.
2024-02-12 17:24:26 +01:00
Sam Ko
ca18f4ff9d
docs(cli): fix next info section title and re-order (#61895)
## Changes

- Update section title from `Next Info` to `Info`
- Adds consistency with other section titles and fixes broken link →
09a764d0fc/packages/next/src/cli/next-info.ts (L100)

Closes NEXT-2425
2024-02-10 17:24:32 -08:00
Lee Robinson
09a764d0fc
docs: follow up from CRA docs (#61893) 2024-02-10 11:59:17 -06:00
Delba de Oliveira
971a1a6421
Docs: Address community feedback (#61857)
Closes: 

- https://github.com/vercel/feedback/issues/54964
- https://github.com/vercel/feedback/issues/54580
- https://github.com/vercel/feedback/issues/54555
- https://github.com/vercel/feedback/issues/54341
- https://github.com/vercel/feedback/issues/54309
- https://github.com/vercel/feedback/issues/53751
- https://github.com/vercel/feedback/issues/55173

Add diagram: https://github.com/vercel/front/pull/29561
2024-02-10 09:59:29 -06:00
Lee Robinson
479faa7117
docs: migrating from CRA (#61866)
Co-authored-by: Michael Novotny <manovotny@gmail.com>
2024-02-09 19:32:53 -06:00
Sam Ko
19adc81e62
docs: update API reference for <Script> (switch to _document.js) (#61875)
## Changes

- Fixes https://github.com/vercel/next.js/issues/61594

Closes NEXT-2421
2024-02-09 21:03:49 +00:00
Sam Ko
8f6f137977
docs: add Page Router only section for beforeInteractive (#61839)
## Changes

Updates `beforeInteractive` section in API Reference docs for Pages
Router

-
https://nextjs.org/docs/pages/api-reference/components/script#beforeinteractive
- Closes https://github.com/vercel/next.js/issues/61594
2024-02-09 20:38:25 +00:00
SaiGanesh21
09c8eae4e0
docs: Example mismatch when changing language JS/TS (#61833)
### What? 
Resolves issue #61695 

### Why?
The `Building Your Application -> Data Fetching -> Server Actions and
Mutations` section in the Next.js documentation has a few mismatches
with respect to JS and TS codes.

---------

Co-authored-by: battuAshita <battua@iitbhilai.ac.in>
Co-authored-by: Sam Ko <sam@vercel.com>
2024-02-08 20:11:42 +00:00
Zack Tanner
13d8b14040
Fix closing a modal example in parallel routes docs (#61819)
The docs mention using a `Link` to close the modal, but navigating away
from a slot that was active won't automatically unmount unless it
matches with a new page for that slot. This is because client-side
navigations don't switch slots from active -> default. Default is only
used on a hard navigation.

I believe this example used to be in here but got removed, so I re-added
with some extra clarity.


Closes NEXT-2405
2024-02-08 11:03:08 -08:00
Jimmy Lai
feb27ad621
Revert "feat(next/image)!: remove squoosh in favor of sharp as optional dep" (#61810)
Reverts vercel/next.js#61696

Closes NEXT-2401
2024-02-08 11:00:34 +00:00
Gen Tamura
72826823d6
Update 02-server-actions-and-mutations.mdx (#61756)
Hi, there.

I have fixed the missing leading slash in the anchor link in Route
Segment Config.

Thanks
2024-02-07 11:36:46 +01:00
Shahzar Mazhar
2145300fe1
fix: showing incorrect filename in example (#61736)
### What?

change filename to `app/dashboard/@analytics/layout.js` in example

### Why?

It  was written incorrect i.e. `app/layout.js`

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

change filename to app/dashboard/@analytics/layout.js

### Why?

It  was written incorrect i.e. app/layout.js

### How?

Closes NEXT-
Fixes #

-->
2024-02-06 20:38:56 +00:00
Steven
07c4ec052e
feat(next/image)!: remove squoosh in favor of sharp as optional dep (#61696)
## History

Previously, we added support for `squoosh` because it was a wasm
implementation that "just worked" on all platforms when running `next
dev` for the first time. However, it was slow so we always recommended
manually installing `sharp` for production use cases running `next
build` and `next start`.

Now that [`sharp` supports
webassembly](https://sharp.pixelplumbing.com/install#webassembly), we no
longer need to maintain `squoosh`, so it can be removed. We also don't
need to make the user install sharp manually because it can be installed
under `optionalDependencies`. I left it optional in case there was some
platform that still needed to manually install the wasm variant with
`npm install --cpu=wasm32 sharp` such as codesandbox/stackblitz (I don't
believe sharp has any fallback built in yet).

Since we can guarantee `sharp`, we can also remove `get-orientation` dep
and upgrade `image-size` dep.

I also moved an [existing `sharp`
test](https://github.com/vercel/next.js/pull/56674) into its own fixture
since it was unrelated to image optimization.

## Related Issues
- Fixes https://github.com/vercel/next.js/issues/41417
- Closes https://github.com/vercel/next.js/pull/54670
- Related https://github.com/vercel/next.js/issues/54708
- Related https://github.com/vercel/next.js/issues/44804
- Related https://github.com/vercel/next.js/issues/48820
2024-02-06 14:17:07 -05:00
JJ Kasper
daf8912627
Add case-sensitive note for revalidateTag/revalidatePath (#61729)
Our tag values are case-sensitive so this ensures we properly document
this so users are aware of this caveat.

x-ref:
https://github.com/vercel/next.js/pull/61392#issuecomment-1926004777

Closes NEXT-2379
2024-02-06 10:30:42 -08:00
Sandeep Mani Kumar Kushwaha
2d488564e6
Fixed #61434 : Docs: Duplicated code snippets (#61446)
<!-- 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?

Issue - Docs: Duplicated code snippets

The code snippet is repeated, second snippet had to be with Link
component.

### How?
Replaced button with Link component.

Fixes #61434 - Docs: Duplicated code snippets

---------

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Sam Ko <sam@vercel.com>
2024-02-05 12:13:29 -08:00
Ishaan
d245079177
Update README.md (#48717)
## Improving Documentation

### The following changes have been made to the official repository's
**Readme.md**:

- Shortened link text across the readme.
- Added additional descriptions for more details.
- Added bold text to highlight emphasis on important topics
- Changed heading sizes to indicate first headings (h1) for each section
instead of second headings (h2) which was previously being used
- Merged _'Who is using Next.js?'_ section with _'Getting Started'_
section for a more professional, cleaner look.

### The following changes have been made to the repository's
**Contribution docs**:

- Fixed two typos in the docs

---------

Co-authored-by: Sam Ko <sam@vercel.com>
Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-02-04 18:47:51 -08:00
Olivier Tassinari
6587a37b00
Mobile Friendly Test was retired (#61647)
https://twitter.com/googlesearchc/status/1731702833060237642
2024-02-05 01:23:58 +00:00
Sam Ko
5284451ed9
docs: update style9 to stylex (#61646)
## Description

The `style9` [repo](https://github.com/johanholmerin/style9) now
recommends `stylex` since `stylex` has been open sourced.
2024-02-04 16:02:15 -08:00
Andrew Paramoshkin
5ed493e548
docs: update useParams examples and pages usage (#61595)
<!-- 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 #

-->

Updated https://nextjs.org/docs/app/api-reference/functions/use-params
with:
* returns block, examples table: route with no dynamic parameters should
return an empty object
* returns block, `pages` usage: if `useParams` is used in `pages` it
will return `null` only for the initial render and will update its value
with dynamic parameters following the same rules as stated in the doc
above this point.

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-02-04 23:44:43 +00:00
Daniel Rivers
5602e6bc14
docs: Add Kinde to authentication docs (#61460)
Added Kinde to the authentication documentation, Its already mentioned
elsewhere in the docs just not here.

Co-authored-by: Lee Robinson <me@leerob.io>
2024-02-04 10:47:37 -06:00
byhow
3fee9e6295
docs: add auto closing tag to <source> (#61546) 2024-02-04 10:47:13 -06:00
hmmChase
d4b1c6c097
Update 03-linking-and-navigating.mdx (#61622)
Fix code example syntax

<!-- 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: JJ Kasper <jj@jjsweb.site>
2024-02-04 00:23:44 +00:00
Steven
804cb937fe
chore(docs): add // @ts-check to next.config.js docs (#61543)
This PR updates the docs to add `// @ts-check` at the top of each
`next.config.js` or `next.config.mjs`.

Even though you can't use `next.config.ts`, you can still get some type
checking to catch typos such as wrong type or even duplicate keys.


<img width="322" alt="image"
src="https://github.com/vercel/next.js/assets/229881/fcaba393-3560-4d16-95bf-a0504e66fa26">

<img width="325" alt="image"
src="https://github.com/vercel/next.js/assets/229881/e7156dd4-7b79-4f08-b843-4431b56b1c50">



Closes NEXT-2335
2024-02-02 00:36:00 +01:00
Stephanie Dietz
9945e8706d
remove note about updating next.config with hostname as this is not n… (#61458)
Since we do not optimize videos, we do not need to add the hostname to
the `next.config.js` file. This PR removes the note telling the reader
to do this.
2024-01-31 11:12:13 -05:00
Delba de Oliveira
70900cebfd
Docs: Add note on default.js receiving params (#61454) 2024-01-31 06:59:36 -08:00
Delba de Oliveira
5d21c6cba1
Docs: Document prefetch null for App Router (#61203)
As per: https://github.com/vercel/next.js/pull/48383
2024-01-31 08:00:30 -06:00
Delba de Oliveira
91cbe61e75
Docs: Add instrumentation.ts API reference, improve instrumentation docs (#61403)
- Add instrumentation.ts API reference
- Polish and restructure instrumentation docs
2024-01-31 07:54:32 -06:00
Delba de Oliveira
68c5edf7ed
Docs: Update migration wording for /pages (#61453) 2024-01-31 07:52:39 -06:00
Stephanie Dietz
0964c12983
Remove the regions option from the config section of the middleware file conventions doc (#61425) 2024-01-30 21:23:12 -06:00
Stephanie Dietz
bc22b21788
add the middleware.ts API reference file convention (#61037)
This PR adds a new docs page under the File Conventions section for
the`middleware.ts` file. It includes:

- Explanation of `middleware.ts` usage in Next.js.
- Code examples in TypeScript and JavaScript.
- Information on `matcher` function, `NextResponse`, and middleware
runtime environment.
- Version history of middleware feature updates.

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
Co-authored-by: Michael Novotny <manovotny@gmail.com>
2024-01-30 13:14:13 -06:00
Sam Ko
e6e95f42bb
chore: update docs around redirect() (#61334)
## Description
- Add a sentence for clarifying redirecting in a Server Component
- Fixes https://github.com/vercel/next.js/issues/61315

Closes NEXT-2284

---------

Co-authored-by: Zack Tanner <zacktanner@gmail.com>
2024-01-29 13:37:06 -08:00
Dima Voytenko
1862b8a0bf
OpenTelemetry: clarify Edge runtime support (#61338) 2024-01-29 12:24:04 -06:00
Dima Voytenko
6eb2c2461f
Telemetry: add time-to-first-byte signal (#61238) 2024-01-29 09:36:12 -08:00
Delba de Oliveira
fa935e5a3c
Docs: Fix headings in Parallel Routes page (#61328) 2024-01-29 08:48:29 -06:00
Aflah vp
5d80989d55
Removed an extra braces and comma from doc (},) (#61250)
<!-- 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-01-29 02:10:47 +00:00
Michael Peters
4701836d2f
docs: typo in page title (#61267)
Simple docs update, title on app router Static Assets page reads as
Statics Assets

Co-authored-by: Sam Ko <sam@vercel.com>
2024-01-29 01:52:27 +00:00
Kenji
093675fa74
docs(02-jest): fixes failing test in the tutorial (#61272)
### What?

This PR fixes the example test provided on [Setting up Jest with
Next.js: Creating your first
test:](https://nextjs.org/docs/app/building-your-application/testing/jest#creating-your-first-test)
not passing due to Jest not being compatible with async Server
Components.

### Why?

Although it's noted at the start of the tutorial that async Server
Components aren't currently supported by Jest, the example test failing
might confuse the reader.

### How?

This PR makes the example test pass by removing async from the `<Home>`
component

Co-authored-by: Sam Ko <sam@vercel.com>
2024-01-29 01:49:45 +00:00
rocketman
755c8d9041
docs: Make server actions maxDuration timeout more clear (#60005)
Co-authored-by: Lee Robinson <me@leerob.io>
2024-01-27 17:19:34 -06:00
Lee Robinson
5d01e4e608
docs: add Lucia auth (#61255) 2024-01-27 09:25:40 -06:00
Delba de Oliveira
94b9afe219
Docs: Adjust message about RootLayout (#61199) 2024-01-26 14:25:52 -08:00
Aleksandr Kondrashov
a3243e6710
Refine revalidatePath warning message (#61220)
<!-- 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 #

-->
#61159 fixed the documentation by removing incorrect information stating
that the type parameter must be set to 'page' when the path contains a
dynamic segment. This PR reflects this change in the warning message,
while confirming that the condition for the warning is already correct.
Additionally, I changed the word "affect" to "effect," assuming it was a
typo. In the documentation, I corrected myself and changed the wording
from "argument is required" to "parameter is required".
2024-01-26 22:05:04 +00:00
Steven
7f4ca97ef8
chore(docs): fix docs for static assets (public) (#61225)
Closes NEXT-2260

---------

Co-authored-by: Lee Robinson <me@leerob.io>
2024-01-26 15:19:54 -05:00
Delba de Oliveira
5fd0f38de9
Docs: Improve and add new parallel routes examples (#60981)
Continuing from: https://github.com/vercel/next.js/pull/60806

- [x] Update **conditional routes** example to render dashboard pages
based on user's role (rather than checking if the user is logged in)
- [x] Add **tab group** example to allow each slot to be navigated
independently.
  - [x] Expand the **modal** example to show full implementation
    - [x] Opening the modal
    - [x] Closing the modal
- [ ] Add **catch-all** slots example
    
Please merge after the diagrams PR:
https://github.com/vercel/front/pull/28770

---------

Co-authored-by: Zack Tanner <zacktanner@gmail.com>
2024-01-26 12:29:30 -06:00
Delba de Oliveira
53b1924b4d
Docs: Add note about revalidatePath invalidating router cache (#61142) 2024-01-26 16:17:24 +00:00
Aleksandr Kondrashov
6bc07792a4
Refine revalidatePath type argument (#61159)
<!-- 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 #

-->

Fixes #61158

If both `page` and `layout` are valid values for the `type` argument of
`revalidatePath` function, and only an empty value is forbidden, this PR
updates the documentation to reflect that.
2024-01-26 13:30:18 +00:00
Yann Bolliger
7a516d469b
Add dot to regex chars in rewrites.mdx (#61095)
The rewrites doc was missing the `.` character when specifying which
characters were used for regex matching.

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

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-01-26 02:41:01 +00:00
Eisa faqiri
d36d61465a
Update generate-sitemaps.mdx (#61167)
<!-- 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-01-26 01:40:04 +00:00
Lee Robinson
c5d470a491
docs: fix Auth0 typo in authentication (#61171) 2024-01-25 23:20:00 +01:00
Dima Voytenko
e6763488b7
OpenTelemetry: update docs for new @vercel/otel (#61044)
Co-authored-by: Andrew Gadzik <andrew.gadzik@vercel.com>
2024-01-25 13:16:39 -08:00
Delba de Oliveira
2d4dbcdfcb
Docs: Add note about calling redirect after try/catch (#61138)
Closes: https://github.com/vercel/next.js/issues/60448
2024-01-25 13:39:39 -06:00
Lee Robinson
d7ff67de67
docs: Combine Pages/App authentication docs (#60848)
Co-authored-by: StephDietz <steph.dietz@vercel.com>
Co-authored-by: Stephanie Dietz <49788645+StephDietz@users.noreply.github.com>
2024-01-25 13:32:02 -06:00
Junior Yono
32212d60fa
Fixed typo in docs (#61118)
Co-authored-by: Steven <steven@ceriously.com>
2024-01-25 09:35:53 -05:00
Delba de Oliveira
9a808e602e
Docs: Update wording on opting out of the Router Cache (#61123) 2024-01-25 00:40:43 -06:00
sogoagain
0cdc927e0f
Docs: Correct JavaScript React Component File Extension to .jsx in '01-vitest.mdx' (#61087)
Hello,

This PR resolves a file extension inconsistency in the 'Setting up
Vitest with Next.js' section of the Next.js documentation
(`01-vitest.mdx`).

When using next.js with JavaScript, following the
documentation(`01-vitest.mdx`) leads to issues during testing because of
the jsx extension.

This PR corrects an example code that wrongly uses a '.js' extension for
a React component, which is against Vitest's requirement for '.jsx'
extensions.
  - https://github.com/vitest-dev/vitest/issues/1564

Thank you.

Co-authored-by: Sam Ko <sam@vercel.com>
2024-01-24 16:10:54 -08:00
Ian Jones
52ba486253
Fix <AppOnly> typo in docs (#61103) 2024-01-24 13:34:57 -06:00
Delba de Oliveira
2eaaad2d16
Docs: Share Redirecting docs with /pages (#61083)
- Share new **Redirecting** docs with /pages
- Add equivalent example for API routes in /pages
2024-01-24 08:23:38 -06:00
Josh Story
b5772b859a
Dynamic APIs (#60645)
formalizes the concept of dynamic APIs inside Next to allow for varying
semantics beyond just staticGenerationBailout.

### Dynamic APIs

#### `markCurrentScopeAsDynamic`
useful to bail out of default caching semantics but does not imply a
Request specific data source was read. critically, this semantic is
ignored if you are inside a cache scope

#### `trackDynamicDataAccessed`
Must be called before reading any data source that is derived from
Request specific data. Currently this is `cookies()`, `headers()`, and
`searchParams`. This kind of data access inside a cache scope is
forbidden (it always should have been, but now it will error).

#### `trackDynamicFetch`
This one is unideal but the complexity of patch-fetch's current
implementation necessitates it for now. Essentially it will postpone if
we are prerendering. Long term this should be eliminated with a refactor
of patch fetch.


### Other Improvements
Also removes the `staticGenerationBailout` implementation as it has been
replaced with more specific logic in the places it was previously being
used.

One area that has also been enhanced is the proxy for app-route modules.
Previously we proxied the Request every time however when we are doing
non-static generation executions we generally don't want the overhead of
wrapping the request. In the refactor here I also improved the runtime
performance by using static proxy handlers and I believe I also fixed a
few bugs related to `clone` and `url`

In general there has been a bit of refactoring to clarify how we should
handle various render/execution states and a reduction in implicit side
effects for proper execution.

Another callout to notice is that app-route modules do not attempt a
static generation if they are force-dynamic regardless of the PPR
setting. Previously the PPR setting would opt them into this code path
which is not necessary because PPR itself does not work for routes, only
pages.

Closes NEXT-2099
2024-01-23 16:06:12 -08:00
Delba de Oliveira
142584cb59
docs: Address community feedback (#60960)
Closes: 

- https://github.com/vercel/next.js/issues/60953
- https://github.com/vercel/next.js/issues/60755

---------

Co-authored-by: Lee Robinson <me@leerob.io>
2024-01-22 19:19:34 -06:00
Lee Robinson
524f4c8178
docs: clarify nginx buffering disable (#61010)
https://github.com/vercel/next.js/pull/60943#issuecomment-1904413114
2024-01-22 19:09:30 -06:00
Mike Timmerman
6b88dc55ae
Update code example on 01-pages-and-layouts.mdx (#60963)
Use nullish coalescing operator in all getLayout examples on
documentation page

Co-authored-by: Sam Ko <sam@vercel.com>
2024-01-22 20:00:46 +00:00
Delba de Oliveira
7181d46f7f
docs: Add link to bloom filter example (#60987) 2024-01-22 13:56:11 -06:00
Mike Dyer
c754d9fb6e
update edge and nodejs runtime doc (#60801)
<!-- 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?
Update the edge-and-nodejs-runtime doc with a Good to Know about a
common build error involving using packages that rely on the filesystem
in an edge runtime environment.

### Why?
The docs don't mention the issue. Most github issues, articles, and SO
answers revolve around updating the next.config with a webpack key to
ignore 'fs' imports in api routes and getServerSideProps functions. This
is incorrect when the issue is using packages that rely on 'fs',
'stream', or 'path' in an edge runtime environment. Silly mistake, but
it costs people time.

### How?
Update the docs. 

Closes NEXT-
Fixes #

-->

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-01-22 13:24:16 +00:00
Prachi Sharma
9cce76ac64
docs: updated the getStaticProps function name (#60949)
Fix: function name getStaticPaths is written in getStaticProps function,
issue exist in get-static-props.mdx under pages/api-reference/functions
folder. This issue was pushed as part of -
Pull Request: 55205
Commit Id: 80fba152f2add326a1520ffd2b530d00c75983f6


![image](https://github.com/vercel/next.js/assets/55828197/90923d4e-9d7b-4bc3-aaf9-7f5ce377410e)

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-01-21 21:11:20 +00:00
Jason
6f39461f8a
docs: Update userScalable property in viewport object and user-scalable in meta tag (#60946) 2024-01-21 14:00:00 -06:00
Lee Robinson
5e80715040
docs: streaming while self-hosting must disable buffering (#60943)
Closes https://github.com/vercel/next.js/issues/54667
2024-01-21 10:52:03 -06:00
Jason
39589ff350
docs: Improves generateViewport documentation (#60396) 2024-01-20 21:11:05 -06:00
Ahmed Abdelbaset
e4172ea373
docs: mention missing optimized by default packages in optimizePackageImports (#60058)
Co-authored-by: Lee Robinson <me@leerob.io>
2024-01-20 20:54:20 -06:00
Ziya Fenn
499fd9302a
docs: clarify redirects behavior with pages router (#60610)
Co-authored-by: Lee Robinson <me@leerob.io>
2024-01-20 20:47:14 -06:00
Lee Robinson
40e2c4623e
docs: small tweak to videos (#60904) 2024-01-19 16:01:50 -06:00
Lee Robinson
ae46eb8835
docs: small tweaks on video docs (#60902)
https://nextjs.org/docs/app/building-your-application/optimizing/videos
2024-01-19 15:28:30 -06:00
Stephanie Dietz
4a74492196
Add documentation page on video optimization (#60574)
I've added a new page to the Next.js docs about optimizing videos. It
covers:

- the native video and iframe tag
- displaying externally hosted videos (i.e. from youtube) 
- self hosting strategies and best practices 
- Video optimization techniques

---------

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
Co-authored-by: Josh Lubawy <jlubawy@gmail.com>
Co-authored-by: Balázs Orbán <info@balazsorban.com>
2024-01-19 13:09:48 -06:00
Liam Laverty
adae5f2cdf
Adds a link to CSP where it's first referenced in the headers docs (#60871)
### What?
Adds a link to CSP documentation the first time it's mentioned in the
headers page here:
https://nextjs.org/docs/app/building-your-application/configuring/content-security-policy

### Why?
Convenience for users, as it's unclear at that point in the document
that `CSP` is discussing `Content-Security-Policy`, and the first
reference to its docs are at the end of the page.

### How?
Added a link to the CSP doc here
https://nextjs.org/docs/app/building-your-application/configuring/content-security-policy
2024-01-19 18:38:33 +00:00
Victor Eke
2de7f953b1
correct description of skipMiddlewareUrlNormalize in advanced middleware flags (#60841)
I think there's some form of typographical error in the
`skipMiddlewareUrlNormalize` line under the advanced middleware flags
section of the docs.

This is the line from the docs [Source
link](https://nextjs.org/docs/app/building-your-application/routing/middleware#advanced-middleware-flags):

> `skipMiddlewareUrlNormalize` allows disabling the URL normalizing
Next.js does to make handling direct visits and client-transitions the
same. There are some advanced cases where you need full control using
the original URL which this unlocks.

Corrected to:

> `skipMiddlewareUrlNormalize` allows disabling URL normalizing in
Next.js to make handling direct visits and client-transitions the same.
There are some advanced cases where you need full control using the
original URL which this unlocks.


<!-- 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-01-19 06:06:42 +00:00
Delba de Oliveira
cb42417985
Docs: Update parallel routes docs, add default.js pt 1. (#60806) 2024-01-18 17:57:54 -06:00
Lee Robinson
ecbc36cdd2
Fix error from the auth docs. (#60829) 2024-01-18 10:24:39 -06:00
Delba de Oliveira
54f73a218e
Docs: Use JS comment for MDX (#60825)
Co-authored-by: Stephanie Dietz <49788645+StephDietz@users.noreply.github.com>
2024-01-18 09:56:53 -06:00
Steven
afcafcdd29
chore(docs): fix example documentation for Art Direction (#60823)
This PR fixes a few typos in the docs from
https://github.com/vercel/next.js/pull/60739
2024-01-18 09:31:00 -06:00
Stephanie Dietz
65fce8aa6b
add authentication docs page (#60388)
I've updated the Next.js documentation to include a new page covering
the best practices for implementing authentication. This doc covers the
essential concepts of authentication in Next.js, focusing on practical
strategies, effective session management, and robust authorization
techniques.

Key aspects of the update:

- Core Authentication Concepts: Introduced foundational concepts of
authentication, detailing their relevance and application in Next.js
projects.
- Diverse Authentication Strategies: Expanded on various authentication
strategies, providing insights on when and how to use them effectively
in different scenarios.
- Implementing Authentication in Next.js: Guided through the
implementation process, illustrating the use of middleware, server
actions, and route handlers to create a secure and user-friendly
authentication system.
- Session Management Techniques: Discussed different approaches to
session management, highlighting their pros and cons to aid in choosing
the most suitable method for specific project needs.
- Securing Application Access: Detailed how to protect routes and manage
user permissions, ensuring that access is granted appropriately based on
user roles and authentication status.
- Next.js Compatible Solutions: Included references to several
compatible authentication solutions for Next.js, facilitating easy
integration and setup.

---------

Co-authored-by: Balázs Orbán <info@balazsorban.com>
Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-01-18 15:21:56 +01:00
Steven
4b50313fd9
feat: stabilize unstable_getImgProps() => getImageProps() (#60739)
This PR renames `unstable_getImgProps` to `getImageProps()` (originally
introduced in PR #51205).

Most feedback [after
announcing](https://twitter.com/leeerob/status/1674250190432116736)
looks positive so it seems like we can safely stabilize this API now.
Its unlikely to change.

I also added documentation with example usage.

Closes NEXT-2120
Fixes https://github.com/vercel/next.js/issues/56009
2024-01-17 18:28:49 -05:00
Lee Robinson
16dcebe792
Stabilize custom cache handlers and changing memory size. (#57953)
This PR stabilizes the previously introduced experimental config options
for providing a custom cache handler (for both ISR as well as the Data
Cache) and for disabling or configuring the in-memory cache size. The
example usage would be as follows:

```js
// next.config.js
module.exports = {
  cacheHandler: require.resolve('./cache-handler.js'),
  cacheMaxMemorySize: 0 // disable default in-memory caching
}
```

This PR also updates the documentation to better reflect how to use the
custom cache handler when self-hosting. Further information will be
added in a following PR that also includes a full example of a custom
cache handler that implements `revalidateTag` as well as passing in
custom cache tags. The API reference docs have been updated here, as
well as a version history added.

I also noticed that we currently have two duplicated versions of the ISR
docs in the Pages Router docs: both for rendering and for data fetching.
Data Fetching is the correct location for this page. There were no other
references to the rendering version in the docs, so that must have been
an accident. I'll need to a get a redirect going for that regardless.

Tests have been updated for `cacheHandler` and I added a new test for
`cacheMaxMemorySize`.

---------

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2024-01-17 23:42:52 +01:00
Dima Voytenko
0c1741c456
Telemetry code load (#60594)
The following spans are either added or displayed by default:

* `NextNodeServer.findPageComponents` - page components
resolution/require
* `NextNodeServer.getLayoutOrPageModule` - load modules (webpack or
turbopack)
2024-01-16 17:08:35 -08:00
Dima Voytenko
f604df1ca1
Telemetry: allow disabling of fetch tracing (#60588)
This would allow different apps to setup fetch instrumentation similar
to `@opentelemetry/instrumentation-http` and
`@opentelemetry/instrumentation-fetch` without duplicating fetch spans
and avoiding confusion with context propagation.
2024-01-16 16:14:22 -08:00
Steven
1886478789
chore(docs): add docs for .svg unoptimized behavior (#60735)
- Fixes https://github.com/vercel/next.js/discussions/53041

Closes NEXT-2119

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-01-16 15:06:42 -05:00
Bang, Jaehun
12713f8aa3
chore: remove duplicate package name (#60652)
Co-authored-by: Steven <steven@ceriously.com>
2024-01-15 14:26:31 -05:00
Brandon Norsworthy
f85d3af12d
Fix Typo in Testing Documentation Description (#60601)
just a small typo I caught, lists 4 testing tools but says three in the
description

first contribution :)
<!-- 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: JJ Kasper <jj@jjsweb.site>
2024-01-15 01:33:12 +00:00
Lee Robinson
126c7f2429
docs: remove Next 13 mention for App Router (#60632) 2024-01-14 11:33:37 -06:00
JJ Kasper
57526b23d0
Add documentation for client router filter (#60585)
This adds documentation around the client router filter we leverage in
`pages` to allow incremental migration from `pages` to `app`. Also adds
mention of two experimental configs that can be useful for managing the
client router filter.

x-ref:
https://github.com/vercel/next.js/issues/47486#issuecomment-1889623898

Closes NEXT-2090

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-01-12 13:37:57 -08:00
Willem-Jaap
756027bf10
fix(mdx): update word order, fix typo (#60466)
Reverse directory order to indicate that `src/` or the parent of `app/`
should be used.
At first I thought the correct place was the parent folder of `src/`,
this eliminates that confusion
2024-01-12 21:16:45 +00:00
Ahmed Abdelbaset
d16ff74a3b
docs: small fix in Redirecting page (#60583)
ref: #60435
2024-01-12 15:08:41 -06:00
Delba de Oliveira
4640ed0604
docs: Add redirecting page in the Routing section (#60435)
New page outlining all options for handling redirects in Next.js, from
the simplest use cases (e.g. `redirect()` in a Server Action), to more
advanced cases (e.g. bloom filters and middleware).

- [x] `redirect`
- [x] `permanentRedirect`
- [x] `useRouter`
- [x] `next.config.js`
- [x] Middleware
- [x] Handling redirects at scale
  - [x] Edge config
  - [x] Bloom filter

---------

Co-authored-by: Lee Robinson <me@leerob.io>
2024-01-12 08:50:30 -06:00