Commit graph

2086 commits

Author SHA1 Message Date
Delba de Oliveira
f518fd81b3
Docs: Fix formatting in testing docs and update examples dependencies (#59572)
Follow-up from: https://github.com/vercel/next.js/pull/59268
2023-12-13 07:02:53 -08:00
Tim Neutkens
55645ffc8a
Fix closing tags for jest docs (#59579) 2023-12-13 15:51:17 +01:00
Jiachi Liu
f1143bc4f4
docs: fix bad closed tag (#59575)
Found this from build error trace while testing the change in #59569 

```
docs/02-app/01-building-your-application/08-testing/02-jest.mdx": UnexpectedMDXError: Error: Build failed with 1 error:
--
  _mdx_bundler_entry_point-776983b1-6900-47c0-98cc-0c35882e9532.mdx:297:0: ERROR: [plugin: @mdx-js/esbuild] Unexpected closing tag `</PageOnly>`, expected corresponding closing tag for `<PagesOnly>
```



Closes NEXT-1863
2023-12-13 15:30:24 +01:00
Delba de Oliveira
0ddc7e8fad
Docs: Add App Router Testing Guides and update /examples (#59268)
This PR updates the testing guides to use App Router and TypeScript,
also updates `/examples` to show `app` and `pages` examples.

## Overview

- [x] Create a new "Testing" section that is shared between `app` and
`pages`.
- [x] Explain the differences between E2E, unit testing, component
testing, etc.
- [x] Recommend E2E for `async` components as currently none of the
tools support it.
- [x] Update setup guides for **Cypress**, **Playwright**, and **Jest**
with latest config options, and examples for `app` and `pages`.
- [x] Add new guide for **Vitest**
- [x] Clean up `/examples`: use TS, show `app` and `pages` examples,
match docs config

## Cypress

- [x] E2E Tests
- [x] Component Testing
  - [x] Client Components
  - [x] Server Components
  - [ ] `async` components

**Blockers:** 
- TS: `Option 'bundler' can only be used when 'module' is set to
'es2015' or later`. In **tsconfig.json** compilerOptions, Next.js uses
"moduleResolution": "bundler", changing it to "node" fixes the issue but
it can have repercussions.
  - https://github.com/cypress-io/cypress/issues/27731 
- Version 14 is currently not supported for component testing
  - https://github.com/cypress-io/cypress/issues/28185

## Playwright

- [x] E2E Tests

## Jest

- [x] Unit Testing
   - [x] Client Components
   - [x] Server Components
- [ ] `async` components:
https://github.com/testing-library/react-testing-library/issues/1209
   - [x]  'server-only': https://github.com/vercel/next.js/pull/54891
- [x] Snapshot Testing

**Blockers:**
- TS: https://github.com/testing-library/jest-dom/issues/546
- None of the solutions in the issue work with Next.js v14.0.4 and TS v5

## Vitest 

- [x] Unit Testing
  - [x] Client Components
  - [x] Server Components
  - [ ] `async` components
  - [x] 'server-only'
 - [x] Update vitest example
- [x] Handles CSS, and CSS modules imports
- [x] Handles next/image

## Other

- https://github.com/vercel/next.js/issues/47448
- https://github.com/vercel/next.js/issues/47299
2023-12-12 22:30:23 -06:00
akawalsky
6fbff29a2e
allow passing wildcard domains in serverActions.allowedDomains (#59428)
Implementation of feature request opened here -
https://github.com/vercel/next.js/discussions/59427

Approach:

~~We are using micromatch in the csrf protection step of actionHandler
to allow for wildcard domains passed in allowedDomains. This is the same
library used for matching domains for remote images.~~

If any of the allowed domains match the origin of the request, we skip
the downstream error thrown for csrf protection.

Edit:

Micromatch is not available in this context as it is only compatible
with Node. This codepath can be run from the edge, so we need to rely on
vanilla js compatible code only.

Instead of falling back to allowing the user to pass in a regex, which
can be somewhat insecure, we opt into continuing to use a wildcard
pattern from a configuration standpoint and instead use a simple
function that matches on wildcards using string comparison and
iteration.

Ideally, Micromatch can be retrofitted to work in non-Node settings and
this piece of code can be replaced in the future, without deprecating or
changing the next.config interface.

---------

Co-authored-by: Josh Story <story@hey.com>
2023-12-12 11:08:36 -08:00
Lee Robinson
c542a761d2
docs: remove broken link in webpack section (#59487) 2023-12-11 08:59:58 -06:00
Eric Bidelman
6e6533c97c
Update 10-route-handlers.mdx (#59443)
According to
https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#dynamic,
the default for dynamic is "auto".

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

-->
2023-12-09 18:52:37 +00:00
Delba de Oliveira
6d82b0698b
Docs: Polish Server Actions Page 💅🏼 (#59400) 2023-12-08 14:41:16 -06:00
Delba de Oliveira
d5836a3038
Docs: Update Server Actions Docs (#59080)
- [x] Rename page from `forms-and-mutations` to
`server-actions-and-mutations` to account for examples that don't use
forms.
   - [x] Split `/pages` and `/app` content to make easier to edit 
- [x] Add Security Section
  - [x] Recommend tainting
  - [x] Closures and encryption
  - [x] Overwriting encryption keys
  - [x] CSRF protection | Allowed Origins
- [x] Add examples for Server Actions being called outside forms
  - [x] `useEffect`
  - [x] Event handlers
  - [ ] ~3rd party libraries~
- [x] More form examples
   - [x] Add note on calling actions in `<button>` and `<input> `
   - [x] Add `.bind` example | Recommend bind over hidden input field
 - [x] Recommend `try/catch` for error handling
- [x] Create `serverActions` next.config.js page 
   - [x] Document `allowedOrigins`
   - [x] Document `bodySizeLimit`
   - [x] Add note on Server Actions flag for < v14
- [x] Update error message links
- [x] Remove Server Actions from API reference as it's a React feature.
E.g. We don't have API references for Server Components.
- [ ] Set up redirects:

---------

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Shu Ding <g@shud.in>
Co-authored-by: Michael Novotny <manovotny@gmail.com>
2023-12-07 15:12:25 -06:00
Zack Tanner
f431600ce4
Revert "added comma to the props list" (#59314)
Reverts vercel/next.js#58596

This is failing lint checks


[x-ref](https://github.com/vercel/next.js/actions/runs/7109843046/job/19355454595)
2023-12-05 20:39:45 -08:00
Justin Pfifer
3f20b46b59
docs: Add note about middleware and runtimes (#58873)
Co-authored-by: Justin Pfifer <justin.pfifer@carvana.com>
Co-authored-by: Lee Robinson <me@leerob.io>
2023-12-05 21:34:37 -06:00
Peter Kellner
4a52268907
docs: Update route handles TS code snippets (#59021) 2023-12-05 21:34:19 -06:00
Thoushif Aazam Shaik
3caa2891c7
docs: added missing comma to the props list (#58596) 2023-12-05 21:33:47 -06:00
Jackie
d0159160dc
docs: update Firebase link to with-firebase example (#58621) 2023-12-05 21:33:14 -06:00
Willem-Jaap
75975dd5e4
docs: Fix incorrect prop name in client component (#58591)
`updateItem` is the name of the action, not the passed prop. The correct
property name is `myAction`.
2023-12-05 21:31:58 -06:00
Jiwon Choi
caa05b4753
docs: Remove invalid URL (#58823)
This PR removes guidance to invalid URL
2023-12-05 21:30:27 -06:00
Mustafa Çor
873bd82ff9
docs: Server Action example (#59159) 2023-12-05 21:21:56 -06:00
Lee Robinson
bb3f0a21a0
docs: fix broken link to learn course (#59288)
Addresses https://github.com/vercel/feedback/issues/47802.
2023-12-05 08:39:54 -06:00
Delba de Oliveira
63a578f1c3
Docs: Fix upgrade guide files (#59249)
- Add v14 update guide to /app router docs
- Fix duplicate /upgrading folders
2023-12-04 08:55:46 -06:00
汪磊
ba23d98611
Correcting the webpack function introduction (#58663) 2023-12-02 08:36:53 +00:00
Jiachi Liu
778fb87131
Support generating multi-meta tahs for metadata api other prop (#59106) 2023-11-30 16:44:49 +01:00
Delba de Oliveira
c1f94cfc73
Docs: Delete fast refresh example (#59003)
Closing: https://github.com/vercel/feedback/issues/47083

This example no longer exists in the Next.js repo.
2023-11-29 15:29:47 -06:00
Zack Tanner
eafaba39cb
update status codes for redirect and permanentRedirect in action handlers (#58885)
### What?
Calling `redirect` or `permanentRedirect` with a route handler used by a server action will result in that POST request following the redirect. This could result in unexpected behavior, such as re-submitting an action (in the case where the redirected URL makes use of the same server action).

### Why?
By spec, 307 and 308 status codes will attempt to reuse the original request method & body on the redirected URL.

### How?
In all cases when calling a `redirect` handler inside of an action, we'll return a `303 See Other` response which is a typical status code when redirecting to a success / confirmation page as a result of a POST/PUT.

The other option would be to use 301 / 302 status codes, but since we're already doing a 303 status code [here](https://github.com/vercel/next.js/blob/canary/packages/next/src/server/app-render/action-handler.ts#L603), this aligns the behavior for the route handler case. 

Closes NEXT-1733
See also: https://github.com/vercel/next.js/issues/51592#issuecomment-1810212676
[Slack x-ref](https://vercel.slack.com/archives/C03S8ED1DKM/p1700060786749079)
2023-11-29 08:35:50 +00:00
Lee Robinson
9656f15a48
docs: patch upgrade guide to pin install version (#58993)
Closes https://github.com/vercel/feedback/issues/47076.
2023-11-29 08:26:03 +00:00
Delba de Oliveira
c5acef6150
Docs: Update revalidate example (#59002)
Closing: https://github.com/vercel/feedback/issues/47084

- The example previously showed `export const revalidate` being called
from a `utils` file, whereas we want to call it from a route segment
(layout or page)
2023-11-28 11:20:05 -06:00
Delba de Oliveira
38e9bc9770
Docs: Add missing diagram (#59008)
Slack feedback. Add missing diagram, and polish wording for `layout.tsx`
explanation.
2023-11-28 11:19:05 -06:00
Jiachi Liu
31809e42f5
Polish unsupported metadata warning with doc link (#58750)
* Add docs link to the warning, add codemod link to viewport docs section
* Only log the warning once after the metadata resolving process, this will avoid multiple duplicated logs showing for one page.

Closes NEXT-1723
2023-11-23 05:42:20 +00:00
Zack Tanner
d9531c13c4
Revert "fix: fetch() behavior when "dynamic" is "force-dynamic" (#58735)
Reverts vercel/next.js#58484

The correct way to address this is to use the `fetchCache` segment: https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#fetchcache

There are valid use-cases to want to force a dynamic response but still need fetch caching.

Additionally, this PR updates the docs, since they're incorrect about behavior.

[slack x-ref](https://vercel.slack.com/archives/C042LHPJ1NX/p1691623048477119?thread_ts=1691613915.257239&cid=C042LHPJ1NX)
2023-11-22 18:49:20 +00:00
Michael Novotny
493f69ffcd
[Next.js Docs] Adds useOptimistic link (#58706) 2023-11-20 21:58:49 -06:00
Lee Robinson
9d14be06d3
docs: clarify route handler caching (#58541)
We've heard confusion around Route Handlers being cached by default for
`GET`s. While we do have a section on this in the docs, I've made this
more explicit by making the examples default to dynamic, while
mentioning the defaults.
2023-11-16 21:43:41 -06:00
empflow
49e391cd2b
docs: fix naming of Route Handlers to Route Handler (#58539) 2023-11-16 21:41:40 -06:00
vivianyentran
fd0c3c63ec
docs: update installation section (#58555) 2023-11-16 21:39:18 -06:00
kentobento
7d2be4be15
docs: Fix grammar in Caching section (#58070)
This PR fixes several grammar issues in
https://nextjs.org/docs/app/building-your-application/caching.

Co-authored-by: Lee Robinson <me@leerob.io>
2023-11-16 21:37:41 -06:00
Gonzalo Pozzo
637ead09e2
Update 04-metadata.mdx (#58535)
Update wrong link
2023-11-16 17:56:02 +00:00
Kom ॐ
d58008279f
docs: Add Jenkins build caching information (#58001) 2023-11-15 23:01:54 -06:00
Antonis Angelis
7226746051
docs: fix filename when it should be dynamic route (#58032) 2023-11-15 22:56:39 -06:00
Mojtaba
8d9282ce9d
docs: fix grammar issue in "Data Fetching Patterns" (#58056) 2023-11-15 22:55:19 -06:00
kentobento
f8343e80dd
docs: Fix grammar in Dynamic Rendering section (#58062) 2023-11-15 22:54:42 -06:00
kentobento
bdbc30f14a
docs: Fix grammar in Client Components section (#58065) 2023-11-15 22:54:21 -06:00
kentobento
1d5c78b925
docs: Fix grammar in Styling section (#58071) 2023-11-15 22:53:10 -06:00
Andreas
05374d3a0c
docs: make example of passing down a Server Action more clear (#57972) 2023-11-15 22:52:48 -06:00
Asad Khan
ee99c9f6e5
docs: fix grammar in revalidateTag docs (#58210) 2023-11-15 22:51:10 -06:00
Marcos Martini
dd4593b937
docs: Added Kinde auth provider (#58231) 2023-11-15 22:50:20 -06:00
Bryn Dyment
123f753042
docs: add missing apostrophe (#58236) 2023-11-15 22:49:43 -06:00
Robbert Stevens
6c422514f6
docs: update MDX metadata docs (#58396) 2023-11-15 22:49:16 -06:00
Asad Khan
8cc406e090
docs: simplify rendering docs (#58185) 2023-11-15 22:46:17 -06:00
Arham Khawar
e5bdc42621
docs: fix unnecessary capitalization (#58141) 2023-11-15 22:45:25 -06:00
Delba de Oliveira
4e5702c1d3
Docs: Update middleware example snippet (#58488)
Sync with example updates made here: https://github.com/vercel/next.js/issues/57410
2023-11-15 15:30:11 +00:00
Asad Khan
1eee93cc94
Update 08-parallel-routes.mdx (#58393)
Fixed Typo

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

-->
2023-11-13 17:55:28 +01:00
Lee Robinson
a01beafddd
docs: Update runtime table (#58361)
Adds a bit more clarity that while the edge runtime certainly enables
faster startups than the Node.js runtime (by being in general lighter),
it does not mean the additional user code added will not affect the boot
time. Hello world might be instant but I believe "low" better reflects
that it _will_ grow with user code added.
2023-11-12 19:28:15 -06:00
Joram van den Boezem
44ec398d4b
chore(docs): fix typo (#58344)
Fix typo in markdown link in "Environment variables" docs article

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

-->
2023-11-12 12:15:21 -06:00
YOSHIDA Junki
d1fe4d01c4
[Docs] remove example for router.events as it does not exist (#58286)
Removed router.events example from the document because it does not
exist.

URL:
https://nextjs.org/docs/pages/api-reference/functions/use-router#routerevents

<!-- 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: Lee Robinson <me@leerob.io>
2023-11-10 09:21:26 -06:00
Tim Neutkens
af2c3f71bf
Update 15-content-security-policy.mdx
Ensures the CSP header is still set on the response.
2023-11-10 14:28:43 +01:00
Tim Neutkens
20ad9ac270
Update 15-content-security-policy.mdx
Removes the passing of headers for the response.
2023-11-10 14:20:33 +01:00
Dennis Wilm
fd534fb696
Update 02-app-router-migration.mdx (#58253)
Corrected a link that linked to the wrong page. 

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

-->
2023-11-09 09:09:31 -08:00
Arseny
e2f3059b48
Add a self-hosted shared cache example (#58000)
### What?

This pull request integrates the exemplary setup for a self-hosted Next.js application utilizing Redis as a shared cache storage. The solution supports caching at both the App and Pages routers in default and standalone modes, as well as partial pre-rendering, facilitated by the [`@neshca/cache-handler`](https://github.com/caching-tools/next-shared-cache/tree/canary/packages/cache-handler) package. The package enables customizing cache handlers and replacing the default cache provided by Next.js seamlessly.

### Why?

The motivation behind this pull request is to provide an example demonstrating how Redis can be used as a shared cache in a self-hosted environment, thereby improving the scalability of hosting multiple instances of a Next.js application.
2023-11-09 14:29:11 +00:00
Lee Robinson
0cdddd419f
docs: update analytics docs for useReportWebVitals (#58196)
[This
page](https://nextjs.org/docs/app/building-your-application/optimizing/analytics)
was not yet mentioning `useReportWebVitals`.

Closes https://github.com/vercel/next.js/issues/57715.
2023-11-09 13:36:33 +01:00
Michael Novotny
5fe14c42d3
[Docs] Add PPR option to next.config.js docs (#58161)
### Description

Adds config for experimental PPR support

### Related Issue(s)/Incident

Prior art: #57444

### Best Way to Test

Visit → docs/app/api-reference/next-config-js/partial-prerendering

Co-authored-by: Amy Burns <5012825+timeyoutakeit@users.noreply.github.com>
Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2023-11-08 16:57:49 +00:00
Zack Tanner
d05b817e3d
fix docs link for ISR (#58207)
x-ref: https://github.com/vercel/next.js/pull/58206#issuecomment-1802174076
2023-11-08 16:31:55 +00:00
Asad Khan
b4ee33e3ec
docs: fix typo in composition patterns section (#58197) 2023-11-08 09:30:25 -06:00
Lee Robinson
cf8a733f6a
docs: mention Middleware on src directory page. (#58193)
Closes https://github.com/vercel/next.js/issues/57923.
2023-11-08 08:18:46 -06:00
Lee Robinson
36490fe27d
docs: remove note about generateMetdata (#58192)
Closes https://github.com/vercel/next.js/issues/57816.
2023-11-08 08:18:00 -06:00
Lee Robinson
24baf8fe46
docs: remove duplicate ISR page. (#58164)
https://nextjs.org/docs/pages/building-your-application/rendering/incremental-static-regeneration already correctly redirects.
2023-11-08 04:23:16 +00:00
Lee Robinson
7e368c2e1f
docs: small follow up on deployment docs. (#58158)
Small visual things and one busted link.
2023-11-07 20:13:51 -06:00
Lee Robinson
958dcbc7e3
docs: Improve deployment docs on self-hosting. (#58027)
This PR is a combination of many months of feedback from the community
on how to self-host with Next.js. It's became clear talking to many of
y'all that there is confusion about if all features are supported when
self-hosting, and what implications this has when using third-party
providers.

The deployment docs now clarify that all features are supported when
self-hosting. However, this comes with important notes. First, we're
building a standard deployment output, not adapters. We want these docs
to ensure that if you follow what's described on this page, you're going
to have a good experience with Next.js and will be able to take
advantage of all features. Previously, we had to add caveats in here
about different providers and their level of support. We are not doing
that anymore.

Instead, we're providing further details on different features and how
they can be configured when self-hosting. These docs have existed in
other locations (e.g. the specific API pages in our docs), but I've
combined and simplified them here so there's one page you need to read
to learn about all of the options. If you self-host Next.js anywhere
with a Node.js server, Docker container, or static HTML export, all of
the following features will work as expected. Further, we've added other
specifics around self-hosting ISR / Data Cache and configuring your
caching location, which is important when self-hosting with Kubernetes.

Finally, there has been a common feature request to allow runtime
environment variables, rather than statically inlining the values during
the build. While this was possible with `getServerSideProps` in the
Pages Router, if the value needed to be used on the component body, this
option didn't work, as it needed to be serialized and forwarded to the
component. With the App Router, this problem is solved, since Server
Components can render entirely on the server. Thus, when dynamically
rendering, you can just use `process.env.MY_VALUE` and it works.

I also toned down the Vercel section, because, it was a bit much TBH.

Related: https://github.com/vercel/next.js/pull/57953

---------

Co-authored-by: Ahmed Abdelbaset <A7med3bdulBaset@gmail.com>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2023-11-07 13:53:09 -06:00
gooby
9b4b0847ed
typo: changed from next/server to next/og (#58143)
### Change the `next/server` to `next/og` to support the upgrade to Next
14

- Next 14 users will experience a deprecation warning when trying to
import from `next/server`
- Not the biggest change, but it caused some confusion while reading

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

-->
2023-11-07 18:38:57 +01:00
Bryan Nguyen
67acc5ac4d
Correct prop name in server-actions.mdx (#58108)
Code snippet below line changed uses `myAction`
2023-11-06 21:54:45 +00:00
Md Rashidul Islam
7feede955f
docs: useFormState and useOptimistic are now documented (#58064)
Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2023-11-05 22:09:12 +00:00
Lee Robinson
100eea486a
docs: Revert part of sitemap docs change (#58010)
Revert part of https://github.com/vercel/next.js/pull/57998.
2023-11-03 18:10:16 -05:00
Yusril A
b8b1ec24a2
docs: improve non-encrypted HTTP conn to a secure (#57998) 2023-11-03 14:51:01 -05:00
Lee Robinson
53b684a795
docs: Update MDX docs title. (#57963)
To better match both keywords.
2023-11-02 19:54:49 -05:00
Chenguang Li
067ff4e978
Update 05-mdx.mdx (#57866)
One more `
2023-11-03 00:54:21 +00:00
OJ Kwon
6f8c580386
feat(turbopack): Experimental wasm build (#57906)
### What?

continuation of https://github.com/vercel/next.js/pull/57851, since it is from a remote branch that I don't have access to write.

Co-authored-by: Maia Teegarden <2865858+padmaia@users.noreply.github.com>
Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
2023-11-02 21:00:54 +00:00
Lee Robinson
9658cf7aad
Move link examples to only Pages Router docs. (#57758) 2023-11-01 14:39:28 +00:00
Gal Schlezinger
f832c56a03
[docs] fix next.config.mjs using commonjs in the example (#57874)
make sure `next.config.mjs` uses `export` instead of `module.exports`
2023-11-01 14:05:38 +00:00
Alexandre Spehler
a07e0de64f
Fix Google Tag Manager URL in Third Party Libraries documentation (#57731)
## Description

Updating the URL for the Google Tag Manager in the Next.js documentation for [Third Party Libraries](https://nextjs.org/docs/pages/building-your-application/optimizing/third-party-libraries).

We were using https://developers.google.com/maps/documentation/embed/embedding-map, which redirected to the documentation for embedding Google Maps.

## Implementation

- Replacing https://developers.google.com/maps/documentation/embed/embedding-map by https://developers.google.com/tag-platform/tag-manager
2023-10-30 16:11:48 +00:00
Tarik
d88d8aed36
Typo fix, version "13" to "14" (#57723)
Typo fix
2023-10-30 00:48:12 +00:00
Joel Hooks
6a8010dbb6
examples: Add inngest next.js example (#56049)
Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-28 11:57:27 -05:00
Kunal Agrawal
ee9a13aaa0
docs: fix incorrect heading structure in codemods (#57605)
Fixes #57593
2023-10-27 20:54:49 -05:00
Anthony Zheng
86d3043d22
docs: Add missing apostrophe (#57626) 2023-10-27 20:53:20 -05:00
Hugo Maestá
26b71fcf9f
docs: Fix typos in third parties section (#57592) 2023-10-27 20:52:44 -05:00
Fatih Kalifa
27106a481b
Fix incorrect link in GTM docs (#57547)
Previously options and link for tag manager refers to maps embed documentation
2023-10-27 01:11:31 +00:00
Hirotomo Yamada
0bb6b56c82
docs: fix 02-dynamic-routes.mdx (#57029)
params from `{}` to `{ slug: [] }`.

Fixes #57027
2023-10-27 01:09:05 +00:00
Gonzalo Pozzo
fa100e29b1
Update docs with a Good to know box about using redirect in client components (#56966)
This adds a new `Good to know` box to explain how to programmatically
redirect in Client Components to avoid people using `redirect` inside
handlers.


![image](https://github.com/vercel/next.js/assets/6494462/20858591-3d21-4a48-bbc9-8a1e0de29ca8)

Co-authored-by: Lee Robinson <me@leerob.io>
2023-10-26 19:57:22 -05:00
Jack Howard
423e945e15
doc: Clarify built-in support for sass after installation (#57279) 2023-10-26 19:52:57 -05:00
Zoe-Bot
f538232fda
docs(fix): example text unescaped entities (#57255)
Fix bug in example code. Loading with `'` can not be built with the default ESLint rules: 
```ssh
./src/app/reviews/loading.tsx
4:15  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
4:26  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
```
2023-10-27 00:20:13 +00:00
Igor Kowalczyk
ab831182bf
Add missing dot in codemod command (#57536)
Add missing dot in `next-og-import` codemod command

```
npx @next/codemod@latest next-og-import .
```
2023-10-26 22:37:47 +00:00
Lee Robinson
92b4d6737c
docs: Next.js 14 (#57342)
- Fetch logging configuration is no longer experimental
- Add `unstable_noStore` reference
- Add `unstable_cache` reference
- Add codemod docs for `next/og` import changes
- Update docs around stable Server Actions
- Add example of revalidating the entire data cache
- Update static export docs for `next export` command removal
- Update minimum required Node.js version
- Add `viewport` and `generateViewport` reference

Co-authored-by: Balázs Orbán <18369201+balazsorban44@users.noreply.github.com>
Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2023-10-26 15:30:43 +00:00
Michael Novotny
fd0a96ffe7
Another lint fix for front (#57511) 2023-10-26 09:57:06 -05:00
Michael Novotny
cbfa126e4b
Fixes lint error on front (#57509) 2023-10-26 14:33:53 +00:00
Jiachi Liu
07483d4b4c
Move serverActionsBodySizeLimit to serverActions.bodySizeLimit (#57433)
Scope all `serverActions` config in one group "serverActions" to make it
more semantics

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-26 08:51:32 +02:00
Houssein Djirdeh
7bee486f7c
Docs: Add documentation for next/third-parties (#57345)
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2023-10-25 23:07:18 -07:00
Maia Teegarden
f412c8a991
Remove wasm target (#57437)
This PR removes the wasm target for the next-swc build for the next major version.  The main motivation is that Turbopack does not support targeting wasm yet, and it would be a significant amount of work to add. We plan to make Turbopack the default zero-config experience in a minor version, possibly before we are able to support a wasm target, so we need to make this breaking change now. We also plan to make more improvements to the webpack experience with shared Rust code, which we have so far been blocked from implementing because of the current wasm restrictions. We would like to support a wasm target again in the future, but cannot say at this time when that would be.


Closes WEB-1865
2023-10-26 02:29:07 +00:00
Jiachi Liu
164e43912d
codemods: migrate viewport related metadata export to viewport export (#57436)
This PR adds the codemods transforming certain fields from `metadata`
export to `viewport` export, will still preserve rest metadata export
properties. We don't cover `generateMetadata` to `generateViewport` as
there might be more complex logic inside the function which is hard to
apply the codemods rules.

TLDR: Codemods for #57302
2023-10-25 16:02:14 -07:00
Jiachi Liu
23f32465d7
types: mark ImageResponse from next/server deprecated (#57372)
* Should show `ImageResponse` is deprecated if you still import from `"next/server"`

<img width="708" alt="image" src="https://github.com/vercel/next.js/assets/4800338/38f9b9db-2cfb-48ec-99cc-08e7d1477155">


* If you build it will fail to compile, this might not be super ideal but at least it's not working. For pure js it will throw errors.

```ts
./app/icon.tsx:7:10
Type error: Only a void function can be called with the 'new' keyword.

   5 |
   6 | export default function icon() {
>  7 |   return new ImageResponse(
     |          ^
   8 |     (
   9 |       <div
  10 |         style={{
 ELIFECYCLE  Command failed with exit code 1.
 ```
2023-10-25 20:48:33 +00:00
Josh Story
5528cc6d4e
Remove the experimental serverActions flag (#57145)
Remove the experimental `serverActions` flag

Co-authored-by: Shu Ding <3676859+shuding@users.noreply.github.com>
Co-authored-by: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
2023-10-20 20:45:25 +00:00
Steven
a3aa6590ff
chore(next/image)!: mark domains as deprecated in favor remotePatterns (#57062)
We already had `domains` as "not recommended" but this PR marks it as "deprecated" and prints a warning if its detected.

I also updated all examples to switch from `domains` to `remotePatterns`.
2023-10-19 20:24:48 +00:00
Jiachi Liu
a3e56c9c1e
Move ImageResponse to next/og (#56662)
### Story

Since we introduced `ImageResponse` into `next/server` export, there're a few libraries relying on `next/server` that accidentally ended up with bundling og image into the bundle. As og package is quite large that could easily raise the size concern for middleware, edge runtime routes.

### Struggles
 We've done optimizations. The tree-shaking strategies are tricky, we tried modularize imports and also optimize cjs require/exports to make sure you're not including og package into bundle if it's not being used. However, it's still not 100% can handle all the bundle optimization cases, such as `import {..} from "next/server.js"` could also ended up with the cjs bundle that failed the tree-shaking.

### Move on
So we decide to move og `ImageResponse` into a separate export `next/og`

Closes NEXT-1660
2023-10-19 14:26:48 +00:00
Steven
27b89e4aaf
chore(docs): fix missing fallback on next/image sizes example (#56718)
This example use of `sizes` was missing the fallback.

Its best to review with [`?w=1`](https://github.com/vercel/next.js/pull/56718/files?w=1)
2023-10-18 17:55:46 +00:00
Steven
3a459ca986
chore(next/image)!: mark onLoadingComplete as deprecated in favor of onLoad (#56944)
## History

We used to pass `onLoad` through directly to the underlying img so `onLoadingComplete` was introduced in order to handle the case when `placeholder="blur"` was used and `onLoad` would trigger before the placeholder was removed.

We have since changed the behavior of `onLoad` so that it acts the same as `onLoadingComplete` and therefore `onLoadingComplete` is no longer needed.

## What is this PR doing?

This PR marks `onLoadingComplete` as deprecated in favor of `onLoad`. In the future, we may remove `onLoadingComplete`.
2023-10-17 21:12:22 +00:00
Juan Martín Seery
308a327923
feat(env): upgrade dotenv (#38481)
Upgraded dotenv to v16. Breaking changes are:

- Multiline parsing support
- Support inline comments
- Backtick support

[See their changelog](https://github.com/motdotla/dotenv/blob/master/CHANGELOG.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`


Co-authored-by: Balázs Orbán <18369201+balazsorban44@users.noreply.github.com>
2023-10-17 00:57:51 +00:00
Josh Story
0a80017d03
Update React from d900fadbf to 09fbee89d. Removes server context and experimental prefix for server action APIs (#56809)
The latest React canary builds have a few changes that need to be
adopted for compatability.

1. the `useFormState` and `useFormStatus` hooks in `react-dom` and the
`formData` opiont in `react-dom/server` are no longer prefixed with
`experimental_`
2. server content (an undocumented React feature) has been removed. Next
only had trivial intenral use of this API and did not expose a coherent
feature to Next users (no ability to seed context on refetches). It is
still possible that some users used the React server context APIs which
is why this should go into Next 14.

### React upstream changes

- https://github.com/facebook/react/pull/27513
- https://github.com/facebook/react/pull/27514
- https://github.com/facebook/react/pull/27511
- https://github.com/facebook/react/pull/27508
- https://github.com/facebook/react/pull/27502
- https://github.com/facebook/react/pull/27474
- https://github.com/facebook/react/pull/26789
- https://github.com/facebook/react/pull/27500
- https://github.com/facebook/react/pull/27488
- https://github.com/facebook/react/pull/27458
- https://github.com/facebook/react/pull/27471
- https://github.com/facebook/react/pull/27470
- https://github.com/facebook/react/pull/27464
- https://github.com/facebook/react/pull/27456
- https://github.com/facebook/react/pull/27462
- https://github.com/facebook/react/pull/27461
- https://github.com/facebook/react/pull/27460
- https://github.com/facebook/react/pull/27459
- https://github.com/facebook/react/pull/27454
- https://github.com/facebook/react/pull/27457
- https://github.com/facebook/react/pull/27453
- https://github.com/facebook/react/pull/27401
- https://github.com/facebook/react/pull/27443
- https://github.com/facebook/react/pull/27445
- https://github.com/facebook/react/pull/27364
- https://github.com/facebook/react/pull/27440
- https://github.com/facebook/react/pull/27436

---------

Co-authored-by: Zack Tanner <zacktanner@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2023-10-16 15:46:10 -07:00
Dmitriy Glazkov
26d0bf27fb
Update 05-mdx.mdx . Fix key of the prop (#56883)
Fix key of the prop

Also the same key prop we can find in `next-mdx-remote` [example with getStaticProps](https://github.com/hashicorp/next-mdx-remote#typescript)
2023-10-16 22:21:44 +00:00
Balázs Orbán
1ff7f07875
feat: drop Node.js 16 (#56896)
### What?

BREAKING CHANGE: Bump the minimum required Node.js version.

### Why?

Node.js 16 has reached end-of-life in September.

Bumped to `18.18.2` since it contained some security-related patches: https://nodejs.org/en/blog/vulnerability/october-2023-security-releases

### How?

Bumped `engines` where needed, upgraded the workflows.

This will allow us to remove quite a few polyfills, I'll open separate PRs for those.
2023-10-16 21:41:38 +00:00
Joris Tirado
21fadd3358
Fix typo (#56863) 2023-10-15 17:18:00 +00:00
Diana Gouveia
db188e480f
docs: fix cypress script typo in 10-testing.mdx (#56765)
fix cypress script name typo to run `cypress:open` as declared on package.json script example
2023-10-14 22:43:32 +00:00
VAS
14aeb49662
Update supported-browsers.mdx (#56815)
Fixed a typo -
docs/04-architechture/supported-browsers.mdx

Changes(s) made -
Fixed a typo for improving clarity
[includes -> include]
'your dependencies includes' -> 'your dependencies include'

Please review and merge it.
2023-10-13 21:04:49 +00:00
Michael Novotny
fd2724ace0
Changes codeblock filename delimiter (#56712)
Based on feedback from #56603, the `/` can be interpreted as file paths instead of filename separators / delimiters. We'll change them to use pipes `|` instead.
2023-10-12 23:18:22 +00:00
Balázs Orbán
6fdba20b6d
docs: fix typo in Update 02-get-static-paths.mdx (#56757)
Fix typo in docs

Fixes #56741

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-10-12 12:18:20 -04:00
Delba de Oliveira
b6cce9ce5e
Docs: Add missing description field (#56749)
Fixing error in next-site due to empty description field.
2023-10-12 08:16:06 -05:00
Farsab
1c07848297
fix(docs): adjust api route documentation examples (#56660)
Fixed the example functions in the documentation to use `async` in order to use `await` within the function body. 

Co-authored-by: Michael Novotny <446260+manovotny@users.noreply.github.com>
2023-10-10 15:23:00 +00:00
Krishnanand Yadav
f6d6acd9ec
Update 01-contribution-guide.mdx: Fix a typo (#56665)
Fix a small typo in the metadata section of the contributing guide.

Kindly add the label: `hacktoberfest-accepted`.
2023-10-10 15:15:13 +00:00
Chris Britten
c8064d69f6
docs(router): clarify dynamic route slug is about a file name, not "folder" (#56596)
### What?

Update documentation on dynamic routing to clarify the use of segment names within file names, rather than referring to them as "folder names".

### Why?

The original documentation used the example term `folderName` when it was referencing dynamic segment names within filenames.  The paths being described here are file names but not folders, and end in a file extension.  This could confuse readers and developers, especially those new to Next.js, leading to potential misunderstandings and misconfigurations.  Perhaps folderName was a relic of a different example wrapping a folder name to do a nested path or other configuration?  But here it seems out of place.

### How?

- Reviewed the provided documentation sections on dynamic routing.
- Replaced references to "folderName" with a different term "segmentName". 
- Ensured the examples provided in the documentation correctly showcase the use of segment names within filenames.
2023-10-10 00:03:49 +00:00
JoRyGu
3f25a2e747
clarify client components render on server on full page load (#55469)
IMO there is not enough of an indicator that client components render on the server on full page loads towards the top of the documentation page. I've seen plenty of experienced devs totally miss this critical info and get stuck on a problem due to a lack of understanding. Putting at least some kind of indicator above the fold would help with that.




Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2023-10-09 14:39:24 +00:00
Zeeshan Ali
bfc2ab9cff
corrected sentence (#56595)
Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2023-10-09 02:08:50 +00:00
Radu Petre Tarean
06ee9d7ca0
docs: update code snippet for correct file name (#56006)
params would be undefined on the /item route, i believe the route should be /item/[id]
2023-10-07 00:41:03 +00:00
jazsouf
82c095f8c2
docs: add missing word (#56547)
small typo




Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2023-10-07 00:23:09 +00:00
Viktor
2c5a8b1abb
Update redirect.mdx (#56414)
Add link to streaming doc
2023-10-04 13:01:10 +00:00
Michael Novotny
f77f222d4f
Updates MDX docs (#56378)
When trying to update my own website to use App Router, I found the current Next.js Docs were missing specifics to get it working (most notably, no mention of `pageExtensions`). Coupled with community feedback, we decided to revisit and rework the entire page.

The page has been walked through and tested on brand new create-next-app projects for both App and Pages Routers to ensure completeness.

Closes [DX-2095](https://linear.app/vercel/issue/DX-2095/improve-nextjs-mdx-docs)

Rendered pages while running locally, in case they are more helpful in seeings the changes and different between routers.

### App Router 

![localhost_3332_docs_pages_building-your-application_configuring_mdx (1)](https://github.com/vercel/next.js/assets/446260/2a2b1a66-c794-4831-ab89-a6a61d02eb84)

### Pages Router

![localhost_3332_docs_pages_building-your-application_configuring_mdx](https://github.com/vercel/next.js/assets/446260/cc60a8a2-a931-4033-aaba-e989a719692d)
2023-10-03 19:32:58 +00:00
Syphini
ef440d40b6
add digest property to error prop (#56339)
Matching the conventions laid out in https://nextjs.org/docs/app/api-reference/file-conventions/error
2023-10-03 14:21:30 +00:00
Daigo Shitara
5254aaecf6
Update image.mdx (#56266)
fix link

Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-10-02 14:29:18 +00:00
Daigo Shitara
0d4859b247
Update image.mdx (#56269)
add closing `'`.

Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-10-02 14:06:23 +00:00
Qing
c20e21bd38
fix: @libsql/client build error (#56192)
Here is the error when building @libsql/client:
<img width="794" alt="image" src="https://github.com/vercel/next.js/assets/7880675/7ec63918-04e1-4468-b552-0aba7225b745">

Here is the [codesandbox](https://codesandbox.io/p/sandbox/nice-feynman-hwjsyd?file=%2Fapp%2Fapi%2Froute.ts%3A8%2C7) to repro it.

Enable the `serverComponentsExternalPackages` the issue will be gone:
<img width="766" alt="image" src="https://github.com/vercel/next.js/assets/7880675/af014f2f-2ab2-4ab7-9e3e-4d4adbae36be">

This PR just adds it to the default package list, so Next.js developers don't have to add it manually.



Co-authored-by: Balázs Orbán <18369201+balazsorban44@users.noreply.github.com>
2023-09-29 13:22:38 +00:00
boylett
769d27aacc
correcting link to useSearchParams ref (#56169)
The link to the useSearchParams ref within the File Conventions > layout.js page currently links to the useParams ref, which is wrong and may lead to confusion as the useParams and useSearchParams APIs operate differently.
2023-09-28 23:11:33 +00:00
Vũ Văn Dũng
7f6a494e9e
docs: Use Response.json over NextResponse.json (#56173)
TypeScript 5.2 now supports `Response.json` (https://github.com/microsoft/TypeScript/issues/52841). That means, if we just need to return a JSON `Response`, we no longer need to import `NextResponse`. This PR updates all such instances in the documentation to use `Response.json`.
2023-09-28 19:36:21 +00:00
Shu Ding
fe90b04f95
(docs) Document Server Actions .bind method (#56164)
This will be the recommended way of passing extra arguments to a Server Action. A couple of reasons behind:

- This is better than putting a hidden `<input hidden value={userId}/>` because that will appear in the SSR'd HTML as full text and cannot be encoded. With `.bind`, we can handle that in the future.
- This is better than event callbacks `onSubmit={(e) => { await updateUser(userId, e.target.formData) }}` as this supports progressive enhancement.
- This is better than re-creating a new action `action={async (formData) => { "use server"; return updateUser(userId, formData) }}` as inlined `"use server"` only works in Server Components.
2023-09-28 16:20:53 +00:00
Bozhen
9cd46e335c
docs: Renamed function that is used by other name (#56170)
In "app/actions.ts" the function is named like create(), but in "app/add-form.tsx" file "createTodo" function is imported and used. This is related to TypeScript examples, .js files are ok.

### What?

Renamed a function.

### Why?

There are two example files in docs ([Error Handling](https://nextjs.org/docs/app/building-your-application/data-fetching/forms-and-mutations#error-handling) section) and the `app/add-form.tsx` is importing function `create` from `app/actions.ts` by another name (`createTodo`).

### How?

Fixed by renaming function to `createTodo`, to match .js file with the same example.
2023-09-28 15:05:24 +00:00
walker flynn
8f3eb01193
Update revalidatePath.mdx to fix confusing wording of arguments section. (#56099)
This part of the documentation was confusing and did not match the below examples.
2023-09-28 01:11:00 +00:00
Vũ Văn Dũng
cf3d73a46b
Add the default import alias to create-next-app prompt for clarity (#55896)
### Why?

Whenever I run `create-next-app` and reach this question

```
Would you like to customize the default import alias? No / Yes
```

I always have to select "No", because I don't remember what this default import alias here is. [It _is_ documented to be `@/*`](https://nextjs.org/docs/app/api-reference/create-next-app#non-interactive), but the documentation is relatively hidden and not many people know about it – it's also easy to forget.

Even more confusingly, the next question ("What import alias would you like configured?") doesn't have this `@/*` as the default answer, but the user's last choice as the default answer instead (which could be different from `@/*` – making people wonder if Next.js changed their defaults overnight).

I suppose it would be better to just make it clear in the prompt itself, so people with skill issues who happen to forget that default value (like me) can still confidently select "Yes" if they want `@/*`, without having to do "No" and manually type `@/*` again.

### How

```diff
- Would you like to customize the default import alias?
+ Would you like to customize the default import alias (@/*)?
```
2023-09-26 22:58:46 +00:00
MUTESA Cedric
730b43d0ce
docs: link from install docs to create-next-app-docs (#55909)
as many developers are moving to bun, its a good idea that it also be included as an installation method.



Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-09-26 15:28:56 +00:00
Martyanov Andrey
9e9e366865
docs: pass base headers while setting nonce (#55708)
Example for setting "nonce", when created, clears the passed headers
2023-09-26 15:12:13 +00:00
water
ed6e8010e4
Update 02-project-structure.mdx (#55940)
Co-authored-by: Balázs Orbán <18369201+balazsorban44@users.noreply.github.com>
2023-09-26 10:08:55 +00:00
Lee Robinson
0e61aa99a2
docs: Add Stytch auth provider (#55777) 2023-09-25 21:41:38 -05:00
Lee Robinson
c7ff12b753
docs: update next-forms example (#55927)
A few bits of follow up from my previous PR updating the forms example.
2023-09-25 21:41:14 -05:00
Abdulghane Jesry
1d86a092ad
Update 03-linking-and-navigating.mdx (#55969)
I've removed a duplicated example.
2023-09-25 18:03:24 +00:00
Matthew Martinez
3dc2c1c7f8
docs-55629 update router cache column in cache interactions api table (#55630)
Fixes https://github.com/vercel/next.js/issues/55629.

Updates the `Router cache` column in the [Cache Interactions API Table](https://nextjs.org/docs/app/building-your-application/caching#apis) to reflect `Revalidate (Server Action)` in the `revalidateTag`, `revalidatePath` and `cookies` rows when used in a Server Action.
2023-09-25 17:48:30 +00:00
3λiȯ+
9d86c1224c
docs: Correct place for passing extension option to createMDX() (#55967)
### What?

Fixing a little mistake in the documentation, where the placement of the `extension` option for `createMDX()` was described as being inside the `options` property:

```ts
const withMDX = createMDX({
  options: {
    extension: /\.mdx?$/,
```

But it's actually a property of its own:


```ts
const withMDX = createMDX({
  extension: /\.mdx?$/,
```

I confirmed that the latter is correct because:

- It solves an issue I was having: Unable to import `.md` files
- On the same docs page, there's another place where it mentions this `extension` option and the code example is correct there
- The option is described in a similar issue, such as https://github.com/vercel/next.js/issues/45431#issuecomment-1410363864
2023-09-25 17:38:01 +00:00
Radu Petre Tarean
fb551c90e7
Update 03-linking-and-navigating.mdx (#55907)
I hope this is right, the description said for a link to be active the pathname should match the href, sorry if its wrong
2023-09-25 17:11:47 +00:00
Deepa Subramanian
9e3c1829b0
docs: add not-found to file conventions page (#55944)
Issue: https://github.com/vercel/next.js/issues/53888

Added "not-found.js" information to error.mdx after the `global-error.js`. Please approve.




Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2023-09-25 15:06:01 +00:00
Vũ Văn Dũng
0b74f51882
docs: Add example on query parameters in route handlers (#55789)
### Why?

There is already an example of handling query parameters (`searchParams`) in route handler, but it's quite hidden (in [Opting out of caching](https://nextjs.org/docs/app/building-your-application/routing/route-handlers#opting-out-of-caching)). It made it hard for many developers to figure out how to do that: [there](https://discord.com/channels/752553802359505017/1127781032242974790) [are](https://discord.com/channels/752553802359505017/752647196419031042/1143181251856044042) [several](https://discord.com/channels/752553802359505017/752647196419031042/1146007247630106704) [people](https://discord.com/channels/752553802359505017/752647196419031042/1154623267164917861) who couldn't find that section in the documentation. (Linked are messages in the Next.js Discord server.)

Therefore this PR adds an example to the route handler documentation on how to do that, so developers can take reference more easily.
2023-09-24 15:23:40 +00:00
Mostafa Gouda
8f7d83f1fd
docs: Add note that Server Actions work with static routes (#55626)
In the new next.js v13.5 blog post, the [other improvements section](https://nextjs.org/blog/next-13-5#other-improvements) mentions:

> [Improvement] Server Actions now work with fully static routes (including revalidating data with ISR)

In the forms and mutation docs page, the [good to know section](https://nextjs.org/docs/app/building-your-application/data-fetching/forms-and-mutations#how-server-actions-work) mentions:

> Currently, if a route uses a Server Action, it is required to [render dynamically](https://nextjs.org/docs/app/building-your-application/rendering/server-components#server-rendering-strategies).

I have changed the good to know section to convey the new improvement mentioned in the v13.5 blog post
2023-09-24 15:03:16 +00:00
João de Vasconcelos
3b8bbe197f
Fix missing async keyword in function declaration (#55887)
Just a one word change to fix the example in https://nextjs.org/docs/app/api-reference/file-conventions/metadata/opengraph-image#generate-images-using-code-js-ts-tsx
2023-09-24 01:54:38 +00:00
Dom Sip
814db26c9c
Revert "fix typo in API Reference - Image Component" (#55889)
Currently the image props section is broken:
https://nextjs.org/docs/pages/api-reference/components/image



Reverts vercel/next.js#55776

fixes: [#55869](https://github.com/vercel/next.js/issues/55869)
2023-09-23 22:30:26 +00:00
Deepa Subramanian
d5db4d366c
Update 10-testing.mdx (#55801)
Made changes as suggested by the reporter. 

```json filename="tsconfig.json or jsconfig.json"
{
  "compilerOptions": {
    "module": "esnext",
    "moduleResolution": "node",
    "baseUrl": "./",
    "paths": {
      "@/components/*": ["components/*"]
    }
  }
}
```

```json filename="package.json"
{
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "cypress:open": "cypress open"
  }
}
```
2023-09-23 01:11:46 +00:00
Lee Robinson
5f4238d9fa
docs: useFormState (#55564)
This PR shows how to use a new React hook `useFormState` in the context
of the [Forms and
Mutations](https://nextjs.org/docs/app/building-your-application/data-fetching/forms-and-mutations)
docs. It also updates the forms example (`next-forms`) to show the
recommended patterns for loading / error states.

Related: https://github.com/vercel/next.js/pull/55399
---
Co-authored-by: John Pham <johnphammail@gmail.com>
2023-09-22 16:10:25 -05:00
Daigo Shitara
380986c535
fix typo in API Reference - Image Component (#55776)
removed unnecessary parentheses

Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-09-22 19:31:20 +00:00
Deepa Subramanian
965fcfa04c
Update 01-pages-and-layouts.mdx (#55795)
``` 
Pages and Layouts
The Pages Router has a file-system based router built on the [concept of pages](https://nextjs.org/docs/pages/building-your-application/routing/pages-and-layouts).
```
Change requested:
Here `concept of pages` hyperlinks routes to the current page. This bit confusing for someone trying to learn next.js. removing the hyperlink to the text would make clear.
2023-09-22 19:16:47 +00:00
Vũ Văn Dũng
a680571d04
Remove the left padding in next info output (#55704)
## Why?

Although the left padding makes the output looks good in the terminal, it causes this weird alignment in almost all bug reports:

```yaml
Operating System:
      Platform: win32
      Arch: x64
      Version: Windows 10 Pro
    Binaries:
      Node: 18.12.0
      npm: N/A
      Yarn: N/A
      pnpm: N/A
    Relevant Packages:
      next: 13.5.2-canary.2
      eslint-config-next: 13.5.2
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.2.2
    Next.js Config:
      output: N/A
```

If I want it to look nice in the bug report

```yaml
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.0.0: Thu Aug 17 21:23:02 PDT 2023; root:xnu-10002.1.11~3/RELEASE_ARM64_T8112
Binaries:
  Node: 20.3.1
  npm: 9.6.7
  Yarn: 1.22.19
  pnpm: 8.6.12
Relevant Packages:
  next: 13.5.2
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.2.2
Next.js Config:
  output: N/A
```

I have to paste this to a text editor and manually remove the first four spaces on every lines.

### How?

This PR removes that four-space padding to make future bug reports look a bit nicer.
2023-09-21 18:26:43 +00:00
S3Prototype
69a8878631
Feedback: Remove line saying server actions is dynamic-only (#55746)
- Removes a line from next docs that is no longer accurate:
> Currently, if a route uses a Server Action, it is required to render
dynamically.
According

With the release of Next.js 13.5, Server Actions now work with fully
static routes (including revalidating data with ISR).


<!-- 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>
2023-09-21 10:43:42 -05:00
Ryan Gillie
90b0352a3e
Docs - Fix VSCode Full Stack Debugging Regex Pattern (#55670)
The most recent Next.js update [redesigned the logging output](https://github.com/vercel/next.js/pull/54713) (which looks great btw) but it broke the uri regex for the VSCode debugger. This PR updates it to use the new pattern.

Output Pattern Before: 
![Alt Text](https://user-images.githubusercontent.com/4800338/265493587-ee181263-3dd4-40d0-9ffc-819a56b45900.png)
Regex Before: `started server on .+, url: (https?://.+)`


Output Pattern After:
![Alt Text](https://user-images.githubusercontent.com/4800338/265130260-9649b340-8241-4756-a2b3-a989f0b74003.png)
Regex After: `- Local:.+(https?:\/\/.+)`

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-09-20 23:24:12 +00:00
Travis Anderson
f0ffa1c79e
add tip for case sensitivity of imports (#55662)
While an import may work on initial load, fast refresh fails, and also this can also cause issues when trying to deploy your project to Vercel, resulting in your component not being found.

This could save people time when they run into this issue, and I wish this small nuance, would've been in the docs.




Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-09-20 21:12:40 +00:00
GabenGar
fcca4ce955
fix(docs): internationalization middleware example (#55645)
- remove the slash before `pathname` (already included in the value).
- add `search` and `hash` values in redirected url:
   - retains these values on redirect
   - they already have `?` and `#` respectively




Co-authored-by: Balázs Orbán <18369201+balazsorban44@users.noreply.github.com>
2023-09-20 11:37:15 +00:00
Jiachi Liu
7e17de9880
docs: move optimizePackageImports to experimental (#55614)
Closes #55611
2023-09-19 21:49:29 +00:00
Jake Boone
3cd4b975c3
create-next-app templates: Change bun run dev commands to bun dev (#55603)
[As of Bun v1.0.0](https://bun.sh/blog/bun-v1.0#changelog-since-v0-8), `bun dev` runs the "dev" script from package.json. Therefore, as with Yarn and pnpm, the "run" command is not necessary.

This PR changes the `create-next-app` README templates to show `bun dev` instead of `bun run dev`.
2023-09-19 19:04:33 +00:00
romeobravo
caa908326f
chore: Fix heading hierarchy in revalidateTag documentation (#55470)
### What?
Fix heading hierarchy in revalidateTag documentation (https://nextjs.org/docs/app/api-reference/functions/revalidateTag)

### Why?
Makes it consistent with https://nextjs.org/docs/app/api-reference/functions/revalidatePath
2023-09-19 01:41:18 +00:00
JJ Kasper
1b8ce8f634
Add route groups example to revalidatePath doc (#55543)
Adds explicit examples for route groups as those may not be obvious from
existing examples.

x-ref:
https://github.com/vercel/next.js/issues/49387#issuecomment-1722575969
2023-09-18 14:40:30 -05:00
Lee Robinson
676e3aeb6d
docs: Update streaming section. (#55408)
Adds a bit more clarity.
2023-09-16 14:58:35 +00:00
Lee Robinson
1ba414034d
docs: optimizePackageImports (#55185)
Follow up from https://github.com/vercel/next.js/pull/54695.
2023-09-16 14:46:49 +00:00
Alexandre Ferreira
cd1a50f133
Update 03-forms-and-mutations.mdx (#55386)
A unique key is required for each item on a list.
2023-09-14 17:17:13 +00:00
Will Binns-Smith
17ba84b7a7
WEB-1135: Update examples and schema for Turbopack loaders config change (#54584)
This addresses inconsistencies with existing examples and config schema
from changes in #49535.


Closes WEB-1451
2023-09-14 14:50:02 +02:00
Umoh Andem
055b5df50d
Update generate-metadata.mdx (#55347)
fixed a grammatical blunder
2023-09-14 02:08:23 +00:00
Ngô Đức Anh
f2f582c17f
Fix network URL logging in start-server (#55260)
### What?
Follow-up of #54926.
While that PR's main fix is no longer necessary due to the removal of render workers, I figure that some changes are nice-to-have and have isolated them into this PR. This includes fixing `appUrl` and `networkUrl` in `start-server`, fixing docs and removing some unnecessary template literals in `turbopack-warning`.

### How?
`appUrl` now tries to use `hostname` instead of `actualHostname` (an address like `example.com` seems to be more useful here than an IP like `xxx.xxx.xxx.xxx`), and `networkUrl` is now prefixed with `http://`.

Other simple changes include fixing docs.



Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com>
2023-09-14 02:01:26 +00:00
Arseny Kruglikov
3561baa5d4
docs: add explicit units to isrMemoryCacheSize option (#55108)
This PR clarifies `isrMemoryCacheSize` value units. Units is not obvious
due to `Defaults to 50MB` comment and lack of TSDoc comments

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-09-13 15:52:04 -05:00
Michael Novotny
fe797c1074
Updates Mozilla links to not include language preference (#55326)
Internal suggestion to remove `en-US` from Mozilla urls since MDN is
available in multiple languages nowadays it will automatically redirect
to the viewer’s language preference.

Closes
[DX-2076](https://linear.app/vercel/issue/DX-2076/make-external-mozilla-links-language-agnostic-in-nextjs-docs)
2023-09-13 11:06:29 -05:00
Lee Robinson
6e3c4e24ed
docs: Add some App Router FAQs (#55186)
Based on questions I've seen in issues and discussions.
2023-09-12 19:45:55 +00:00
Daigo Shitara
49a876d456
Update route-segment-config.mdx for fix broken link (#55212)
Fixed link to `Node.js Runtime` in the revalidate section, as the link
was broken by the leading `/`.

Co-authored-by: Steven <steven@ceriously.com>
2023-09-12 15:43:19 -04:00
JJ Kasper
c2f587640a
Update docs for revalidatePath fix (#55083)
This updates docs for the fixes landed in
https://github.com/vercel/next.js/pull/53321 related to
`revalidatePath`.

Fixes: https://github.com/vercel/next.js/issues/49387

---------

Co-authored-by: Lee Robinson <me@leerob.io>
2023-09-12 11:28:16 -07:00
Pekka Enberg
45ee4ed260
Add libsql to external package list (#55266)
The `libsql` package is a fork of `better-sqlite3` that powers the Turso database client. Let's add `libsql` to the list of external packages, like `better-sqlite3`, so that people don't have to add extra configuration for their Next.js applications.
2023-09-12 16:48:48 +00:00
Lee Robinson
591d4e11ef
docs: clarify setting cookies docs (#55149) 2023-09-11 15:19:57 -05:00
Daniel Salvadori
e486d74464
Fix typo (#55245)
This PR fixes a single character typo.
2023-09-11 12:09:06 -07:00
Lee Robinson
9d529e525f
docs: satisfies follow up (#55234)
Follow up from https://github.com/vercel/next.js/pull/55205/files#r1321306801.
2023-09-11 13:59:27 +00:00
Lee Robinson
9de2fd53e8
docs: use satisfies for TypeScript code blocks (#55205)
Yay, TS 4.9!

https://twitter.com/leeerob/status/1563540593003106306
2023-09-11 10:04:54 +00:00
Lee Robinson
9b98e1ccc6
docs: fix nested list (#55178)
Seems to be rendering fine here (https://nextjs.org/docs/messages/react-hydration-error) with actual numbering
2023-09-10 13:08:29 +00:00
Dalton McPhaden
a8f300dd0f
Update 01-server-components.mdx (#55085) 2023-09-07 03:27:57 +00:00
Callum Silcock
cc34ea52ff
docs: example of generated nonce to use base64 encoding as per spec (#55039)
nonce's are limited to characters found in base64 encoding, uuids contain '-' which breaks the spec,
converting to a base64 string after generating simplifies this

---

This was a bit gotcha in our project, there are a few tools that only expect there to be a single `-` and do a split based off it (so when there are >1 they fail)

## Rules for nonce's

- The nonce must be unique for each HTTP response
- The nonce should be generated using a cryptographically secure random generator
- The nonce should have sufficient length, aim for at least 128 bits of entropy (32 hex characters, or about 24 base64 characters).
- Script tags that have a nonce attribute must not have any untrusted / unescaped variables within them.
- The characters that can be used in the nonce string are limited to the characters found in base64 encoding.
2023-09-06 22:52:51 +00:00
Lee Robinson
3f29268133
docs: Remove app reference on pages doc for runtimes. (#55058) 2023-09-06 15:19:32 +00:00
CSY54
b3ed162fe2
docs: add missing quotation mark (#54968)
There is a quotation mark missing in the docs. Adding it back in this PR.
2023-09-06 07:22:31 +00:00
迷悟
57bbc59028
docs: fix typo (#54973) 2023-09-06 07:16:19 +00:00
Hyewon Kim
85fb714f16
docs: Fix typo in getting-started/project-structure (#55035)
<!-- 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 #

-->

- Fix typo in [Next.js Project Structure: Top-level
files](https://nextjs.org/docs/getting-started/project-structure#top-level-files)
- It's common to create it as `next-env.d.ts` without dots.
2023-09-06 00:12:17 -07:00
JJ Kasper
2f31fa9476
Update eslint dependencies note in docs (#55023)
Closes: https://github.com/vercel/next.js/issues/54105
2023-09-05 19:01:27 +00:00
Lee Robinson
930db5c1af
docs: Add template API reference (#54938)
Ports content from the Pages and Layouts section about templates and formats to match other API reference pages.

Co-authored-by: Michael Novotny <446260+manovotny@users.noreply.github.com>
2023-09-04 16:54:56 +00:00
Chanhee Lee
85f9e1b751
docs: Fix typo in app/building-your-application/caching (#54841)
- fix typo in [Building Your Application: Caching](https://nextjs.org/docs/app/building-your-application/caching#fetch-optionsnexttag-and-revalidatetag)
- `options.next.tags` is correct (current: `options.next.tag`)
2023-09-03 17:25:35 +00:00
Robert Bradford
17da2ca1fe
docs: Move general info about next.config.* to its index page (#53542)
I was reading through the current https://nextjs.org/docs/app/api-reference/next-config-js/pageExtensions and noticed it started explaining different file formats for the `next.config.*` file. Is that information better suited for the https://nextjs.org/docs/app/api-reference/next-config-js index page?

There was also a little redundancy at the top. 

Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2023-09-03 00:12:47 +00:00
Rousan Ali
d58603fb63
docs: Update Vercel YouTube channel url (#54912) 2023-09-03 00:10:00 +00:00
Fuma
f74f676f73
docs: Clarify the ability to access current route segments in layouts (#53349)
> Layouts do not have access to the current route segment(s). To access route segments, you can use useSelectedLayoutSegment or useSelectedLayoutSegments in a Client Component.

The term "current" is confusing. 
It should be only the route segments under the layout. For example: `app/layout.tsx` can not access `app/[slug]`.
2023-09-02 23:55:18 +00:00
Curtis L
96e13c3bf1
docs: add missing word in client components (#54830)
Missing word in client component page in docs when discussing the effect of "use client" on a client component's children and imported components. Not sure if 'children' is the appropriate word or whether there should be a reference to imported components too.
2023-09-02 23:47:56 +00:00
Florentin / 珞辰
a0beb340ca
docs: add maxDuration in API Routes config (#54844)
Update the code snippet for configuring API Routes to include `maxDuration` as an option.

Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2023-09-02 23:43:11 +00:00
imageck
6c098a74e3
docs: Minor formatting fix in Pages Router SSG (#54915) 2023-09-02 23:34:21 +00:00
Rob Johansen
166f556f69
Fix typo in description of error.js (#54933) 2023-09-02 22:57:49 +00:00
Lee Robinson
5eea161d8b
docs: Add docs on CSP and nonce generation (#54601)
There's been some confusion on the correct way to add a `nonce`, so took the opportunity here to:

- Add a new docs page for Content Security Policy
- Explained how to generate a `nonce` with Middleware
- Showed how to consume the `nonce` in a route with `headers`
- Updated the `with-strict-csp` example
- Update the `nonce` error message page
- Backlinked to the new page in a few places in the docs
2023-09-01 22:13:49 +00:00
Bora Öksüzoğlu
f621defc11
Docs: Add changeFrequency and priority attributes to sitemaps (#54863)
https://nextjs.org/docs/app/api-reference/file-conventions/metadata/sitemap

Co-authored-by: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
2023-09-01 14:36:41 +00:00
Michael Novotny
e2584c6fb3
Updates minimum node version in documentation (#54839)
Updates minimum node version in documentation as we've changed what we require since written.

DX-2046
2023-09-01 04:02:24 +00:00
Sadaf
ac56bcafa7
docs: define router instance in code block (#54707)
…g scroll
2023-08-31 03:21:46 +00:00
Aryan Malik
4f0b7156a4
docs: Add JS/TS code switchers to Middleware (#54726)
In case a user needs a `js` code
2023-08-31 03:19:21 +00:00
Xvezda
44509f690a
docs: fix syntax error in i18n example code block (#54749)
Added missing comma to fix syntax error in i18n configuration example.
2023-08-31 03:16:55 +00:00
Mateusz Aliyev
a759711cab
docs: remove typo in use-selected-layout-segments.mdx (#54767)
This pull request removes a typo in `use-selected-layout-segments.mdx`.

![image](https://github.com/vercel/next.js/assets/82393815/3c2717cf-212b-4d99-b403-3f90193adf42)
2023-08-30 13:27:47 +00:00
Lee Robinson
dc55050894
docs: Change Vite guide title (#54774) 2023-08-30 13:23:15 +00:00
Michael Angelo Rivera
d02124aae6
docs: clarify data type in Forms and Mutations section (#54630)
### What?

Clarify the "Forms and Mutations" docs. 

### Why?

This may be opinionated, but I believe this section of the docs starts out assuming that the user knows how the `<form>` HTML works. Coming from the client side React world, most developers are used to using state in forms. Clarifying that this data is accessible via the standard web API [FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData/FormData) is essential for both transitioning developers and new developers.
2023-08-30 13:20:55 +00:00
vinay
8374e24a39
(Docs) Add missing JS-Code, cookies function names updated accordingly. (#54703)
Changed the name of the actions to `delete` and `read` to indicate the appropriate operation.
2023-08-30 12:03:17 +00:00
Ed Putans
75c641522d
Fixed typo in Building your application > 03. Rendering section (#54764)
<!-- 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: Balázs Orbán <info@balazsorban.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-08-30 13:59:02 +02:00
Igor Gassmann
e8c71ed2ea
docs(upgrading): add "Migrating from Vite" guide (#53214)
### What?

This adds to the docs a guide for migrating a Vite application to
Next.js. It also contains a section that lists the reasons why one would
want to switch from Vite to Next.js.

### Why?

This guide is helpful for developers that want to switch to Next.js but
don't know how difficult that would be and how to do it. The "Why?" list
is also helpful to developers who haven't yet been convinced to switch
or need help formulating the reasons to switch to decision-makers.

This guide was [first published on the Inngest
blog](https://www.inngest.com/blog/migrating-from-vite-to-nextjs). To
our own surprise, we were able to [migrate from Vite to
Next.js](https://github.com/inngest/inngest/pull/479) our [Dev Server
app](https://github.com/inngest/inngest/tree/main#the-inngest-dev-server)
in less than a day, which motivated us to share our learnings with the
community.

### How?

The guide aims to have the minimum number of steps to get a working
Next.js application so that
the reader can then adopt Next.js features incrementally. This means the
migration of the router isn't part of this guide. However, this would be
something valuable to document at a later time so that the reader can
also learn how to migrate to the App Router and get all the Next.js
benefits.
2023-08-29 14:17:05 -05:00
Ryo Matsukawa
d2e4d2c170
docs: Standardize heading levels (#54590)
## What?

- Updated the heading structure in the documentation to maintain a consistent hierarchy.
- All primary points now use `###` for better readability and understanding of content structure.

## Why?

While reviewing the documentation, I noticed that the heading levels were inconsistent between sections 1, 2, and 3-5.
2023-08-29 18:34:13 +00:00
Shohei Maeda
efd8d22654
Add new permanentRedirect function in App Router (#54047)
for internal:
https://vercel.slack.com/archives/C03S8ED1DKM/p1691700057242999

### Problem

- The existing [`redirect()`
function](https://nextjs.org/docs/app/api-reference/functions/redirect)
can't control the status code.
- The existing [`redirect()`
function](https://nextjs.org/docs/app/api-reference/functions/redirect)
returns a 307 HTTP redirect response while it returns a 308-equivalent
meta tag `<meta http-equiv="refresh" content="0;url=/foo"/>` in
streaming response (e.g., suspense boundary), making the behavior
inconsistent.

### Solution

Adding a new `permanentRedirect()` function and changing the meta tag
default accordingly.

| func   |      HTTP status      |  meta tag |
|---|:---:|---|
| `redirect()` | 307 | `<meta http-equiv="refresh"
content="1;url=/foo"/>` |
| `permanentRedirect()` | 308 | `<meta http-equiv="refresh"
content="0;url=/foo"/>` |

ref.
https://developers.google.com/search/docs/crawling-indexing/301-redirects

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-08-28 14:22:43 -07:00
Krychaxp
bdfbde5db8
Update revalidatePath.mdx (#54631)
add if statement, because typescript throws error: revalidatePath require `string`, but `searchParams.get('path')` returns `string|null` type




Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-08-28 20:33:49 +00:00
Donovan Dikaio
41368670a3
docs: fix small typo (#54656) 2023-08-28 07:25:51 +00:00
Emilio Schaedler Heinzmann
a699c980aa
docs: updates generateMetadata function signature (#54638)
Change optional arg to non-optional arg of `parent` in the `generateMetadata` API function example in oder to avoid the error shown below.
 
![Screenshot 2023-08-27 at 15 23 02](https://github.com/vercel/next.js/assets/103655828/a39dc0c0-ab1b-4a26-9ac0-1e9ddcfd11da)
2023-08-27 23:21:48 +00:00
Lee Robinson
68331892cc
docs: Add JS code snippets for forms (#54577)
https://nextjs.org/docs/app/building-your-application/data-fetching/forms-and-mutations

Some of the code blocks where I only specified TS code snippets aren't
working with JS as well (when there are no types). I think I might have
incorrectly assumed you could leave those out. So added the JS snippets
in here (same code, just different file names).
2023-08-27 11:37:10 -05:00
Chan Nyein Thaw
a221121002
Update revalidatePath to revalidateTag (#54633)
Fix typo in `revalidateTag.mdx`. Updated `revalidatePath` -> `revalidateTag`
2023-08-27 15:58:25 +00:00
Delba de Oliveira
05dbd9a8a2
Docs: Update Edge runtime and data revalidation information (#54499)
Fixes: https://vercel.slack.com/archives/C042LHPJ1NX/p1692666204185669

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-08-26 18:33:15 -07:00
Vector73
f2766b979b
docs: Fixes typo in route handlers (#54605) 2023-08-26 15:24:16 -05:00
Lee Robinson
b048d7eee2
docs: Forms and mutations (#54314)
This PR is a larger change to documentation to make the following
updates:

- Deconstructs [Server
Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions)
into "Forms and Mutations" and an API reference
- Removes content in place of future React API documentation pages
- Removes outdated [Building
Forms](https://nextjs.org/docs/pages/building-your-application/data-fetching/building-forms)
docs from the Pages Router and adds conditional content for both routes
in "Forms and Mutations"
- Adds TypeScript code blocks to API Routes page, recommends Route
Handlers for isomorphic signatures.
- Updates `revalidatePath` and `revalidateTag` docs to have a Server
Actions example.

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2023-08-25 14:31:11 -05:00
Clément Dreptin
41be932238
docs: fix source files hash calculation (#54509)
Hello!

I recently tried to cache the `.next/cache` directory in a GitHub action following what was said in the documentation and realized that hashing the source files didn't work properly.

This problem also occured in [next-cache](https://github.com/jongwooo/next-cache) and was fixed by [this PR](https://github.com/jongwooo/next-cache/pull/17).

This PR simply changes the example from the documentation to apply the same fix (stop using brackets in the patterns passed to `hashFiles`).

Hope it helps!

### Improving Documentation

- [x] Run `pnpm prettier-fix` to fix formatting issues before opening the PR.
- [x] Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide
2023-08-25 16:04:21 +00:00
Steven
6a70ebf2aa
chore(docs): add example of sanity image to loaderFile config (#54529)
https://www.sanity.io/docs/image-urls
2023-08-25 14:10:26 +00:00
Ahmed Abdelbaset
7ac6bb1a88
docs: Add missing parameters to both useSelectedLayoutSegment & useSelectedLayoutSegments (#53602)
This PR adds missing parameters to the `useSelectedLayoutSegment` & `useSelectedLayoutSegments` hooks since they take *optional* `parallelRoutesKey`.

Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2023-08-24 23:14:47 +00:00
Lee Robinson
4e052deff2
docs: fix broken link missing leading slash (#54520) 2023-08-24 17:19:23 +00:00
Delba de Oliveira
94b7743cbe
Docs: Fix formatting issues in the rendering docs (#54517) 2023-08-24 16:49:46 +00:00
Delba de Oliveira
1dc5c066cb
docs: Rewrite Rendering Section and React Essentials Page (#51579)
We initially wrote the [React
page](https://nextjs.org/docs/getting-started/react-essentials) to
introduce Server Components in the App Router, but over time, some
implementation details have changed, and the information has become
stale. The React team is working on adding new docs, so I'd like to
change the narrative on the Next.js docs from "client vs. server
components" to "writing code for the server and for the client" - and
link back to the React documentation when it becomes available.

As React developers, we're very familiar with writing code for the
client, it's nice and simple. But doing so comes at the expense of not
being familiar with the server. The aim of these docs is to help
developers become proficient in both the client and server environments.

I'd like to take it back to the foundations, and not use abstractions
like SSG and CSR, MPAs or SPAs, as those terms come with their own set
of assumptions that make it harder to understand how RSC works. Instead,
we'll focus on the request lifecycle, show how application code flows
from the server to the client, and discuss the trade-offs of doing
operations in each environment.

- [x] Page: Rendering Fundamentals
   - [x] Environments: Client and Server
   - [x] Request-response lifecycle
   - [x] Network Boundary
- [x] Page: Server Components
    - [x] Benefits and use cases of server rendering
    - [x] How to use Server Components in Next.js
    - [x] How Server Components are rendered
    - [x] Static Rendering
    - [x] Dynamic Rendering
    - [x] Streaming
- [x] Page: Client Components
    - [x] Benefits and use cases of client rendering
    - [x] How to use Client Components in Next.js
    - [x] How Client Components are rendered
        - [x] Initial vs. Subsquent navigation
- [x] Page: Composition Patterns
    - [x] When to use client and server components
    - [x] Server Component Patterns
    - [x] Client Component Patterns
    - [x] Interleaving Client and Server Components
- [ ] ~Diagrams~ will follow up with new PR.
- [x] Set up redirects: https://github.com/vercel/front/pull/24917

---------

Co-authored-by: Térence Hollander <hollanderterence@gmail.com>
Co-authored-by: shawnthwei <32075290+shawnthwei@users.noreply.github.com>
Co-authored-by: Michael Novotny <manovotny@gmail.com>
2023-08-24 08:48:44 -05:00
Uzair Ali
32f11c34e8
Update 10-testing.mdx (#54107)
Fixed `next/jest.js` import in documentation. without `.js` it show this error
```
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'F:\React\my-project\node_modules\next\jest' imported from F:\React\my-project\jest.config.mjs
Did you mean to import next/jest.js?
    at new NodeError (node:internal/errors:399:5)
    at finalizeResolution (node:internal/modules/esm/resolve:326:11)
    at moduleResolve (node:internal/modules/esm/resolve:945:10)
    at defaultResolve (node:internal/modules/esm/resolve:1153:11)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
    at link (node:internal/modules/esm/module_job:76:36)
 ```
2023-08-24 12:02:00 +00:00
David Porter
be5f9baf74
docs: Add next-i18n-router as a resource for internationalized routing (#52344)
### Why?
Many developers are asking how to add internationalized routing in the App Router as it works in the Pages Router. [next-i18n-router](https://www.npmjs.com/package/next-i18n-router) is a very helpful package that fully solves this challenge.

### How?
Unlike the example provided in these Next.js i18n docs, [next-i18n-router](https://www.npmjs.com/package/next-i18n-router) does not require nesting all pages in a `[lang]` dynamic segment. It also allows for the default language to be accessible without a locale prefix in the path (just like in the Pages Router).

It includes locale detection based on the `accept-language` header as recommended in the Next.js docs, as well as support for the `NEXT_LOCALE` cookie to set a user's preferred language (just like in the Pages Router).
2023-08-24 01:07:43 +00:00
Lee Robinson
ed3aea924d
docs: Remove unneeded word in caching docs (#54451) 2023-08-23 16:24:31 +00:00
Delba de Oliveira
06be3c6cf5
Docs: Remove runtime configuration from /app docs (#54336)
Remove runtime configuration from app docs as it's not available. 

Fixes: https://vercel.slack.com/archives/C03S9JCH2Q5/p1692029581031809
2023-08-23 12:42:50 +00:00
Delba de Oliveira
705b2ef2d4
Docs: Refer users to IDE or MDN for manifest object options (#54385)
Based on feedback here:
https://vercel.slack.com/archives/C03S9JCH2Q5/p1692712555316389?thread_ts=1692710113.742499&cid=C03S9JCH2Q5
2023-08-22 09:50:53 -05:00
Delba de Oliveira
83394b900b
Docs: Document manifest metadata file (#54380)
Add missing docs for `manifest` metadata file. 

Fixes: https://github.com/vercel/next.js/issues/54296
2023-08-22 14:35:41 +00:00
Delba de Oliveira
9ca82f68ed
Docs: Clarify status codes w/ streaming (#54374)
Clarify what status code is returned when streaming, and in relation to `redirect` and `not-found`. 

Relates to: https://github.com/vercel/next.js/pull/54361

Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2023-08-22 14:03:56 +00:00
Delba de Oliveira
f0ff3c468c
Docs: Update template.js section (#54370)
Fixes: https://vercel.slack.com/archives/C03S9JCH2Q5/p1692619927373449

- Updates wording on nesting, to say it's not the actual output, but rather how `template.js` nests between `layout.js` and its children.
- Remove mention of animations, needs further clarification.
2023-08-22 09:05:38 +00:00
Steven
f6d2aa09de
fix: minimum node version 16.14.0 (#54331)
- Fixes https://github.com/vercel/next.js/issues/54269
- Related to https://github.com/vercel/next.js/pull/54285
2023-08-22 08:58:53 +00:00
Delba de Oliveira
0c85f8aad3
Docs: Add notes that revalidation is not available in the Edge runtime / only Node.js (#54338)
Fixes: https://vercel.slack.com/archives/C03S9JCH2Q5/p1692261964220369
2023-08-21 22:00:40 +00:00
Delba de Oliveira
3bce82e807
Docs: Fix broken links (#54340)
Fix broken links picked up by crawl-analysis: https://vercel.slack.com/archives/C03S9JCH2Q5/p1692621216597749
2023-08-21 16:33:38 +00:00
Tooooooooon
5d758c7ec0
update readme in nextjs testing (#54322)
Co-authored-by: Michael Novotny <446260+manovotny@users.noreply.github.com>
2023-08-21 15:32:13 +00:00
Laurent Thiebault
71d424e804
docs: update a small typo in 02-app/01-building-your-application/06-optimizing/01-images.mdx (#54311)
Hello,

I just make this PR because the `/me.png` example is not in "remote images" section but in "local images", that's why I propose to edit this :)

Thank you!

### Improving Documentation

- [x] Run `pnpm prettier-fix` to fix formatting issues before opening the PR.
- [x] Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide
2023-08-20 18:33:16 +00:00
Joseph
76997cc053
docs: Bump minimum Node.js version to 16.14 (#54285)
### What?

Docs change.

### Why?

- https://github.com/vercel/next.js/issues/54269

### How?

Bump the Node.js version shown at: https://nextjs.org/docs/app/building-your-application/upgrading/app-router-migration#nodejs-version 

Fixes #54269
2023-08-20 03:03:02 +00:00
Willi-m
baef523fb0
[Docs] fix missing ' in data-fetching/fetching-caching-and-revalidating (#54058)
In https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#opting-out-of-data-caching a single quote (`'`) is missing.

![CleanShot 2023-08-15 at 17 08 58](https://github.com/vercel/next.js/assets/179761/eccd5fc9-a2fd-4c11-968f-76fd33fc5317)
2023-08-15 14:12:56 +00:00
Matt Cowley
c1fa78bf6c
fix(next/image): empty blur image when animated (#54028)
Partial fix for #54012: do not generate a blur image in the image loader when the image is detected to be animated, rather than returning the *entire* animated image as the blur image.
2023-08-15 02:17:40 +00:00
Tibor Sándor
b4d5ddb834
Update opengraph-image.mdx: Fix typo (#54020)
This commit fixes a typo in the `<head> output` (twitter-image.alt.txt) code block
2023-08-14 21:05:22 +00:00
Kyle McDonald
3d569bd92a
Open Graph Image font declaration moved to correct place (#53998)
When implementing `opengraph-image` in my [personal-site-project](https://github.com/kylemcd/personal-site). I was consistently running into issues where custom fonts would either only work locally or only work on vercel. To me it seemed like differences in pathing in `edge` vs `nodejs` runtimes. After digging around I found issue #48081, more specifically [this comment](https://github.com/vercel/next.js/issues/48081#issuecomment-1565842740) where moving the `fetch` for the font into the `Image` function solved the issue.

I'm not sure if this is 100% the correct fix, or if this is an issue that needs to be solved in another way. If that's not the case this PR updates the documentation around `opengraph-image` to have the fetch for custom fonts inside of the `Image` function.
2023-08-14 19:36:13 +00:00
Lacy Morrow
3958fc0732
Update 05-client-side-rendering.mdx with latest tanstack query version (#54009)
### What?
Update Tanstack query URL

### Why?
The latest Tanstack query version is v4, the docs currently list v3
2023-08-14 18:28:12 +00:00
Aryan Malik
5ec7933f6b
Update 11-middleware.mdx: Added Switcher (#53977)
Added a switcher on a code snippet under heading -> `Using Cookies`, just like the other code snippets on this page got one..

(For those who don't know what a switcher is -> It's just a simple functionality for changing `typescript` code to `javascript` and vice-versa, kind of a UI feature for better experience`

Co-authored-by: Balázs Orbán <18369201+balazsorban44@users.noreply.github.com>
2023-08-14 12:32:23 +00:00
Tim Neutkens
983feeb3da
Fix typo in partial navigation section (#53981)
Noticed a small typo, this fixed it.

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

-->
2023-08-14 10:36:04 +02:00
Hüsrev
5cda9af70f
The extra word 'the' has been deleted (#53951) 2023-08-12 21:37:51 +00:00
Kevin Pham
ea0bb97729
Docs: fix pnpm command for saving dev deps (#53937) (#53938)
Previous of after (before in linked issue)
```
❯ pnpm add --save-dev @next/eslint-plugin-next
Already up to date
Progress: resolved 525, reused 517, downloaded 0, added 0, done
Done in 6.4s
```

Resolves #53937
2023-08-12 07:52:46 +00:00
Artur Bień
e0ca2ba544
feat(image): DataURL placeholder support for <Image /> (#53442)
Adds support for base64-encoded `placeholder`. Enables using placeholders without the "blur" effect.

Fixes #47639
- [x] Add support for DataURL placeholder
- [x] Add tests
- [x] Update docs

Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-08-11 23:45:20 +00:00
Banbarashik
424b205344
fix typo (#53908)
remove misused pronoun "it"

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-08-11 21:59:31 +00:00
Shu Ding
10cb74062b
(docs) Fixes Server Actions example (#53920)
Closes #53910.
2023-08-11 18:25:31 +00:00
Delba de Oliveira
1cafeb4102
Docs: Update confusing wording in intercepting routes (#53854)
Fixes: https://github.com/vercel/next.js/issues/53787
2023-08-11 08:59:03 +00:00
Colin McDonnell
7e16538485
Include instructions for bun package manager (#53590)
## For Contributors

### Improving Documentation

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

### What?

Add instructions for using `bun/bunx` where relevant. I only added mentions where npm/yarn/pnpm were all already listed. 

### Why

Bun can be used as a runtime-agnostic [package manager](https://bun.sh/package-manager) and script runner in any project with a `package.json`.

(Sorry, I probably should have consolidated this with https://github.com/vercel/next.js/pull/53467)

Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-08-10 23:44:20 +00:00
Steven
2cf5d3a8aa
chore(docs): note cache-control header for preview/draft mode (#53825)
You can technically get similar ISR behavior setting the `Cache-Control` in `getServerSideProps()`, but this won't be automatically bypassed when enabling Preview Mode or Draft Mode so this PR adds that to the documentation.

x-ref: [slack discussion](https://vercel.slack.com/archives/C03S8ED1DKM/p1691514209722429)
2023-08-10 14:05:54 +00:00
Lee Robinson
1286e145b0
docs: Opting out of scrolling with next/link and useRouter. (#53804)
Addressing comments from https://github.com/vercel/next.js/issues/49087.
Introduced with https://github.com/vercel/next.js/pull/51869.
Related https://github.com/vercel/next.js/issues/50105.

This PR adds documentation for `next/link` and useRouter` about how to disable scroll restoration.
2023-08-10 09:41:56 +00:00
Steven
89be8c4b35
chore(docs): add missing "try it out" (#53815)
Follow up to https://github.com/vercel/next.js/pull/53760

This follows the same pattern as other demo links on this page.
2023-08-10 00:30:56 +00:00
Lucas Constantino Silva
0350e00d0d
docs: document cache tagging mechanism (#53806)
This PR document the cache tagging semantics in Next.js, and how to benefit from it during cache revalidation.
2023-08-09 23:18:02 +00:00
Lee Robinson
3077a0e9ff
docs: Add more information about Server Actions (#53805)
A few helpful additions based on conversations I've had recently.
2023-08-09 15:48:24 +00:00