Commit graph

1868 commits

Author SHA1 Message Date
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