Commit graph

19019 commits

Author SHA1 Message Date
Zack Tanner
490d23805f
fix default handling in route groups that handle interception (#59752)
### What?
Navigating to a layout that is part of a route group that uses route
interception currently will trigger a 404 error if the route group
doesn't define a `default` segment.

### Why?
When `next-app-loader` injects fallback defaults into the loader tree,
it does so by first seeing if a default already exists. However it does
this without ignoring route groups, meaning if you have a
`/app/default.tsx` and your interception route is at
`/app/(level1)/(level2)`, it will look for the default at
`/app/(level1)/(level2)/default.tsx`.

When a `default` isn't found, the fallback behavior is to trigger a
`notFound()` error. This means navigating to the intercepting route that
has no `default` for the `children` segment will 404.

### How?
This adjusts the fallback behavior by attempting to find the `default`
by normalizing the segment path, which will ignore route groups. That
way `/app/(level1)/(level2)/default` will first check `/app/default.tsx`
before falling back to `notFound` behavior.

Fixes #59279
Closes NEXT-1813
2023-12-20 08:07:31 -08:00
Jiachi Liu
d14410ce32
Optionally bundle legacy react-dom/server APIs based on usage (#59737) 2023-12-20 16:50:06 +01:00
Vercel Release Bot
8e0fd93242
Update Turbopack test manifest (#59798)
This auto-generated PR updates the integration test manifest used when
testing Turbopack.
2023-12-20 11:22:56 +01:00
James Burgess
ead2a7eb70
docs: add missing comma to sitemap.mdx (#59788)
<!-- 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 #

-->
The example is not valid TS because of this missing comma.

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2023-12-20 09:43:40 +00:00
Tobias Koppers
771705f961
Revert "fix: gracefully shutdown server (#59551)" (#59792)
This reverts commit 2c48b8796b.

It breaks some test cases

Closes PACK-2168
2023-12-20 07:43:27 +01:00
Sakib Hossain
3b72c52176
docs: change 'themeColor' to 'viewport' in the viewport section (#59764) 2023-12-19 22:12:40 -06:00
Lee Robinson
29fcd57ed1
docs: clarify data fetching pattern (#59602)
You don't fetch data with Server Actions, but mutate.
2023-12-19 20:24:21 -06:00
Braden Kelley
2c48b8796b
fix: gracefully shutdown server (#59551) 2023-12-20 00:52:46 +01:00
vercel-release-bot
38758cb631 v14.0.5-canary.19 2023-12-19 23:19:49 +00:00
Usman S. (Max Programming)
2caf1882d9
Change file extension to .tsx (#59763)
Changes the file extension from `.ts` to `.tsx` in these 2 places


![image](https://github.com/vercel/next.js/assets/51731966/b91654cf-290c-4aa8-bf90-41e266bf0bc4)

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
Co-authored-by: Michael Novotny <manovotny@gmail.com>
2023-12-19 19:10:15 +00:00
Jiachi Liu
9d94372952
chore: extends from shared base tsconfig (#59776) 2023-12-19 18:52:22 +01:00
Houssein Djirdeh
25e0988e7c
[Docs] Includes section to @next/third-parties documentation for Google Analytics (#59671) 2023-12-19 16:05:02 +01:00
Donny/강동윤
a65fb16298
fix: Allow start turbopack dev server for a project using middleware (#59759)
### What?

Configures `scoped_tls` (in `swc_common`) correctly.

### Why?

One of the company websites fails to **start**.

https://vercel.slack.com/archives/C03EWR7LGEN/p1702970892605989

### How?

Closes PACK-2165
2023-12-19 20:35:42 +09:00
Andrew Clark
63825de4d5
LayoutRouter: Support segment value of Promise<null> to asynchronously bail out and trigger a server patch (#59724)
If the data for a segment is missing when LayoutRouter renders, it
initiates a lazy fetch to patch the cache. This is how all dynamic data
fetching works in the pre-PPR implementation.

For PPR, we won't use this mechanism anymore for regular navigations,
but (at least for now) we will still use it as a fallback behavior if
the server response does not match what we expected to receive.

This commit adds support for asynchronously triggering a lazy fetch, by
unwrapping the segment data promise inside LayoutRouter to check if it's
missing. If so, it will trigger the lazy fetch mechanism.

When PPR is not enabled this should not observably impact behavior.

Closes NEXT-1893
2023-12-18 20:26:34 -05:00
vercel-release-bot
5308a3d25c v14.0.5-canary.18 2023-12-18 23:22:18 +00:00
mknichel
f8864fd20c
Remove path normalization logic when uploading .next/trace traces (#59305)
When uploading traces from `.next/trace`, target paths that trigger
compilations were being normalized to paths like
`[project]/../../../../../middleware`. This PR removes the normalization
logic so that the triggers appear as `/middleware` which is easier to
understand.
2023-12-18 13:15:02 -08:00
Vercel Release Bot
bef5234225
Update font data (#59722)
This auto-generated PR updates font data with latest available
2023-12-18 09:46:22 -08:00
Jordan Newland
10a4ffcc10
docs: fix grammar issue in 03-get-server-side-props.mdx (#59670)
Hey Next.js Maintainers, 👋🏻

Quick PR to address a minor grammar error in the Pages docs.

Closes #59669

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-12-18 09:44:52 -08:00
Ahmed Abdelbaset
3e6edbf850
docs: fix vitest example link in testing with vitest (#59659)
This PR fixes a wrong link introduced in #59268

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-12-18 09:42:10 -08:00
Jon Meyers
4462354da1
Fix: Add matcher for middleware (#59651)
### What?
- exclude assets from middleware

### Why?
- avoid refreshing session logic running unnecessarily

### How?
- export matcher config from middleware

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-12-18 09:40:44 -08:00
Joseph
7eac1c8ee9
fix: Invalid next version tag name in with-cypress example (#59647)
<!-- 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 #

-->

Hi,

Fix for the accidental change, introduced in this PR
https://github.com/vercel/next.js/pull/59572, which set the `next`
version tag for the with-cypress example, to `^latest`, which causes the
`create-next-app` step to fail:

```shell
npx create-next-app --example with-cypress with-cypress-app
Creating a new Next.js app in /Users/<user>/<Project-Path>/with-cypress-app.

Downloading files for example with-cypress. This might take a moment.

Installing packages. This might take a couple of minutes.

npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "^latest" of package "next@^latest": Tags may not have any characters that encodeURIComponent encodes.
```

Yarn instead, shows a list of next.js packages to select from instead.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-12-18 09:37:33 -08:00
David Agbenyega
1c3e305876
Docs: Review and Typo Fix - getServerSideProps (#59616)
<!-- 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-12-18 09:30:18 -08:00
Lee Robinson
1c65c55750
docs: improve docs around geolocation and IP headers (#59719)
Based on feedback from https://github.com/vercel/next.js/issues/47793, I
made some improvements around the geolocation docs. Specifically around
`request.ip`, `request.geo`, and how to access these values. I noticed
there was a bit of a divergence, as some of the `NextRequest` and
`NextResponse` docs were split out for the App Router section, but not
all.

This PR finishes that swing by removing the previous catch-all for
`next/server` in the Pages Router docs and splits them into individual
docs pages.

Wrote a lil' thread about this:
https://twitter.com/leeerob/status/1736543599339172121

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2023-12-18 07:55:48 -06:00
Delba de Oliveira
e3c2552514
Docs: Polish testing section (#59618) 2023-12-18 07:29:47 -06:00
Delba de Oliveira
ee425d4cb2
Docs: Document generateSitemaps (#59626) 2023-12-18 13:40:56 +01:00
vercel-release-bot
3951c7be4f v14.0.5-canary.17 2023-12-17 23:22:07 +00:00
Lee Robinson
64d539fc50
docs: fix broken backtick for link (#59717)
<img width="764" alt="CleanShot 2023-12-17 at 11 25 10@2x"
src="https://github.com/vercel/next.js/assets/9113740/437a8a0d-0f56-4199-9629-b767569349de">
2023-12-17 09:53:59 -08:00
vercel-release-bot
1f798f4647 v14.0.5-canary.16 2023-12-16 23:21:32 +00:00
Lee Robinson
565c5b20b0
docs: small tweaks (#59638)
Just some random cleanup I wanted to do.
2023-12-16 14:13:17 -06:00
vercel-release-bot
2e14537fc1 v14.0.5-canary.15 2023-12-15 23:22:05 +00:00
Zack Tanner
1fa7a74a5c
Update React from 2c338b16f to 0cdfef19b (#59666)
Updates React from 2c338b16f to 0cdfef19b.

### React upstream changes

- https://github.com/facebook/react/pull/27821
- https://github.com/facebook/react/pull/27820
- https://github.com/facebook/react/pull/27818
- https://github.com/facebook/react/pull/27819
- https://github.com/facebook/react/pull/27817
- https://github.com/facebook/react/pull/27703
- https://github.com/facebook/react/pull/27796
- https://github.com/facebook/react/pull/27811
- https://github.com/facebook/react/pull/27804
- https://github.com/facebook/react/pull/27807
- https://github.com/facebook/react/pull/27805
- https://github.com/facebook/react/pull/27792
- https://github.com/facebook/react/pull/27788
- https://github.com/facebook/react/pull/26852
- https://github.com/facebook/react/pull/27790
- https://github.com/facebook/react/pull/27786
- https://github.com/facebook/react/pull/27785
- https://github.com/facebook/react/pull/27783
- https://github.com/facebook/react/pull/27784
- https://github.com/facebook/react/pull/27769
- https://github.com/facebook/react/pull/27766
- https://github.com/facebook/react/pull/27701
- https://github.com/facebook/react/pull/27732
- https://github.com/facebook/react/pull/27740
- https://github.com/facebook/react/pull/27767
- https://github.com/facebook/react/pull/27768
- https://github.com/facebook/react/pull/27765
- https://github.com/facebook/react/pull/27759
- https://github.com/facebook/react/pull/27579
- https://github.com/facebook/react/pull/27709
- https://github.com/facebook/react/pull/27734
- https://github.com/facebook/react/pull/27739
- https://github.com/facebook/react/pull/27717
- https://github.com/facebook/react/pull/27583
- https://github.com/facebook/react/pull/27713

Closes NEXT-1887
2023-12-15 08:51:45 -08:00
Tim Neutkens
dff1cd5b6a
Move changeSubscription for _document to finally to mirror page handling in Turbopack (#59664)
## What?

Moves the changeSubscription for _document into the finally block,
similar to how the page itself is handled there as well.
This should allow moving the rest of the try block into a separate
function that can be reused for builds too.


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

## For Contributors

### Improving Documentation

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

### Adding or Updating Examples

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

### Fixing a bug

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

### Adding a feature

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


## For Maintainers

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

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->


Closes NEXT-1885
2023-12-15 17:21:34 +01:00
Tim Neutkens
8c4649e781
Consolidate manifest writing for Turbopack in a single function (#59663)
## What?

I'm working on consolidating a bunch of the file writing related pieces
in the Turbopack handling in the dev server so that it can be abstracted
out as it's needed for `next build` too.

These changes make sure that there is a single `writeManifests()`
instead of picking specific manifests to write.

We can optimize this later but for now the overhead of writing them to
disk separately is negligible.


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

## For Contributors

### Improving Documentation

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

### Adding or Updating Examples

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

### Fixing a bug

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

### Adding a feature

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


## For Maintainers

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

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->


Closes NEXT-1884
2023-12-15 17:21:19 +01:00
Zack Tanner
dd57054647
Fix parallel routes with server actions / revalidating router cache (#59585)
### What?
There are a bunch of different bugs caused by the same underlying issue,
but the common thread is that performing any sort of router cache update
(either through `router.refresh()`, `revalidatePath()`, or `redirect()`)
inside of a parallel route would break the router preventing subsequent
actions, and not resolve any pending state such as from `useFormState`.

### Why?
`applyPatch` is responsible for taking an update response from the
server and merging it into the client router cache. However, there's
specific bailout logic to skip over applying the patch to a
`__DEFAULT__` segment (which corresponds with a `default.tsx` page).
When the router detects a cache node that is expected to be rendered on
the page but contains no data, the router will trigger a lazy fetch to
retrieve the data that's expected to be there
([ref](5adacb6912/packages/next/src/client/components/layout-router.tsx (L359-L370)))
and then update the router cache once the data resolves
([ref](5adacb6912/packages/next/src/client/components/layout-router.tsx (L399-L404))).

This is causing the router to get stuck in a loop: it'll fetch the data
for the cache node, send the data to the router reducer to merge it into
the existing cache nodes, skip merging that data in for `__DEFAULT__`
segments, and repeat.

### How?
We currently assign `__DEFAULT__` to have `notFound()` behavior when
there isn't a `default.tsx` component for a particular segment. This
makes it so that when loading a page that renders a slot without slot
content / a `default`, it 404s. But when performing a client-side
navigation, the intended behavior is different: we keep whatever was in
the `default` slots place, until the user refreshes the page, which
would then 404.

However, this logic is incorrect when triggering any of the above
mentioned cache node revalidation strategies: if we always skip applying
to the `__DEFAULT__` segment, slots will never properly handle reducer
actions that rely on making changes to their cache nodes.

This splits these different `applyPatch` functions: one that will apply
to the full tree, and another that'll apply to everything except the
default segments with the existing bailout condition.

Fixes #54173
Fixes #58772
Fixes #54723
Fixes #57665

Closes NEXT-1706
Closes NEXT-1815
Closes NEXT-1812
2023-12-15 15:51:14 +00:00
vercel-release-bot
65634bea54 v14.0.5-canary.14 2023-12-15 15:31:03 +00:00
Tim Neutkens
a0c68c5d02
Fix issue with outputFileTracingExcludes and pages/api edge runtime (#59157)
## What?

Ensures `Object.entries` is not called on the `Map`. Seems this only
fails in a very particular case but potentially this fixes other issues
than the one I added in the tests too.

## How?

`Object.entries()` results in an empty array when called on a `Map`.
Created a shared type declaration for the value and removed the
`Object.entries`. Benefit of this is that we can skip the loop as well.


<!-- 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-15 16:27:03 +01:00
Tim Neutkens
5d091ed9f9
Change manifestPath to pagesManifestPath (#59657)
## What?

Small clarification on the variable name.

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

## For Contributors

### Improving Documentation

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

### Adding or Updating Examples

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

### Fixing a bug

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

### Adding a feature

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


## For Maintainers

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

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->


Closes NEXT-1882
2023-12-15 16:03:50 +01:00
Jiachi Liu
d3205561d2
refactor and simplify app dynamic components (#59658) 2023-12-15 15:33:46 +01:00
Kenji
7faaeeb9b0
docs: updates WCAG version to 2.2 (#59646) 2023-12-15 07:02:34 -06:00
Tim Neutkens
98e0a56caf
Refactor setup-dev-bundler to make Turbopack/Webpack split clearer (#59650)
## What?

Small refactor to move Turbopack hotreloader interface creation to a
separate function: `createHotReloaderTurbopack`.
Renamed `HotReloader` to `HotReloaderWebpack`. 

Initially wanted to move `createHotReloaderTurbopack` to a separate file
but it relies on a bunch of in-scope variables so that is not
straightforward. Will do that later.


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

## For Contributors

### Improving Documentation

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

### Adding or Updating Examples

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

### Fixing a bug

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

### Adding a feature

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


## For Maintainers

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

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->


Closes NEXT-1881
2023-12-15 13:32:58 +01:00
Tim Neutkens
90bfbe72bb
Add tests for invalid React server APIs (#59622)
Follow-up to #59621.

Adds tests for:

- findDOMNode
- flushSync
- unstable_batchedUpdates
- useFormStatus
- useFormState

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

## For Contributors

### Improving Documentation

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

### Adding or Updating Examples

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

### Fixing a bug

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

### Adding a feature

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


## For Maintainers

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

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->


Closes NEXT-1877
2023-12-15 10:12:46 +01:00
vercel-release-bot
05eb8114f9 v14.0.5-canary.13 2023-12-14 23:22:14 +00:00
Wyatt Johnson
2da04af2e8
Partial Pre Rendering Headers (#59447)
This fixes some of headers (and adds associated tests) for pages when
PPR is enabled. Namely, the `Cache-Control` headers are now returning
correctly, reflecting the non-cachability of some requests:

- Requests that postpone (dynamic data is streamed after the initial
static shell is streamed)
- Requests for the Dynamic RSC payload

Additionally, the `X-NextJS-Cache` header has been updated for better
support for PPR:

- Requests that postpone no longer return this header as it doesn't
reflect the cache state of the request (because it streams)
- Requests for the Prefetch RSC now returns the correct cache headers
depending on the segment and pre-postpone state

This also enables the other pathnames in the test suites 🙌🏻 

Closes NEXT-1840
2023-12-14 13:14:06 -07:00
Tim Neutkens
42d6e3092e
Fix useOptimistic in server components bug. Add tests for invalid React server APIs (#59621)
## What?

Fixes a bug where `useOptimistic` wouldn't trigger a compiler error when
imported in Server Components.

Adds tests for the following `import { x } from 'react'` in Server
Components, where `x` is the value:

- Component
- createContext
- createFactory
- PureComponent
- useDeferredValue
- useEffect
- useImperativeHandle
- useInsertionEffect
- useLayoutEffect
- useReducer
- useRef
- useState
- useSyncExternalStore
- useTransition
- useOptimistic

These show a particular error explaining how to add `"use client"`:

![CleanShot 2023-12-14 at 14 49
37@2x](https://github.com/vercel/next.js/assets/6324199/e47eab71-b2a2-4c14-bec0-0d5cdd720e80)





<!-- Thanks for opening a PR! Your contribution is much appreciated.i:
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-14 21:09:41 +01:00
Shohei Maeda
6b3d145e7e
docs: add note for environment variables on Vercel deployment (#59237)
Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2023-12-14 15:33:41 +01:00
Tim Neutkens
002af4eb3a
Add test for importing client components from server actions (#59615)
## What?

Adds two tests for server actions returning client components:

- (supported) Importing a server action from a server component. That
server action imports a client component and returns it.
- (not supported yet) Importing a server action from a client component.
The server action imports a client component and returns it.

The second case is not supported yet as it would effectively mean a
compilation loop:

`server` -> `client` -> `server` -> `client`

and if that last client component includes another server action it goes
even further:

`server` -> `client` -> `server` -> `client` -> `server` (and if that
server action includes anothe client component it goes further and
further)


Whereas currently it's only `server` -> `client` -> `server`, so it's
limited to that.

In the future we should be able to support this
server->client->server->client loop in Turbopack specifically because
Turbopack has a single module graph.

Importing the client component in a server action that is defined in the
server compiler (i.e. when created inline or when imported from a server
component) it does work correctly already.

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

## For Contributors

### Improving Documentation

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

### Adding or Updating Examples

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

### Fixing a bug

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

### Adding a feature

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


## For Maintainers

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

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->


Closes NEXT-1873
2023-12-14 13:23:55 +01:00
Delba de Oliveira
d2fd8f77ea
Docs: Review and update getServerSideProps page (#59545)
- Remove recommendation for client-side rendering
- Cut repetition 
- Improve tone
2023-12-13 20:42:28 -06:00
vercel-release-bot
5f1e90960d v14.0.5-canary.12 2023-12-13 23:22:15 +00:00
OJ Kwon
1145d27077
test(integration): adjust fixture to work with turbopack (#59595) 2023-12-13 13:17:52 -08:00
vercel-release-bot
e3b0294c9e v14.0.5-canary.11 2023-12-13 18:58:07 +00:00