Commit graph

15375 commits

Author SHA1 Message Date
Avi Avinav
c57b687abb
Update metadata interface types (#48259)
<!-- 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 or adding/fixing Examples

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

### Fixing a bug

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

### Adding a feature

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



## For Maintainers

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

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->

This PR changes the example given in metadata interface types for google
site verification, this line:
https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/metadata/types/metadata-interface.ts#L322.

Fixes NEXT-989
Fixes #48257

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2023-04-12 14:30:41 +00:00
Yamagishi Kazutoshi
958150d15b
Add suffix to static metadata images (#48202)
### What?

The change in #47985 breaks the URLs of static image files like
`/(group)/opengraph-image.png` to `/opengraph-image.png-012345`.
References from `/` are also broken.

### Why?

This is because only `opengraph-image.ts` and `opengraph-image.tsx` are
considered.

### How?

In this Pull Request, we are trying to solve the problem by including
similar support for `opengraph-image.png` and `opengraph-image.jpeg`.

---------

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2023-04-12 14:30:31 +00:00
Sean Massa
3003bff6fa
ensure original matcher source is free of mutations (#47980)
In a previous PR (https://github.com/vercel/next.js/pull/46753), the
`originalSource` was saved to be passed along through the build process.
This was done a bit too late in the flow, which made `originalSource`
include some transformations.

Because `originalSource` is used for display purposes, we need it
unmodified. This PR preserves `originalSource`.
2023-04-12 16:55:45 +02:00
Jiachi Liu
805183e3e9
Temporarily disable app dir export integration test (#48291)
As the integration tests are keeping failed on canary, turns out that
the require hook didn't set up properly so when running the
app-dir-export integration test it breaks others. Will re-enable it once
migrated to e2e tests

x-ref:
https://github.com/vercel/next.js/actions/runs/4668919790/jobs/8266728783?pr=48252#step:6:149
x-ref:
https://github.com/vercel/next.js/actions/runs/4668707070/jobs/8266215431?pr=48252#step:6:325
x-ref:
https://github.com/vercel/next.js/actions/runs/4675947717/jobs/8281764592?pr=48276
2023-04-12 15:53:18 +02:00
JJ Kasper
8273ba5660 v13.3.1-canary.5 2023-04-12 13:16:22 +00:00
Jimmy Lai
92ddc4a27d
parallel routes: remove the per-route default 404 handler (#48286)
This PR fixes an issue where throwing a notFound error in a parallel
route at the top level at the root level would trigger a notfound
boundary at the parallel route level, which meant in practice that you
could still see the other slots being rendered below.

This behaviour is undesirable and was caused by the fact that we were
inserting a default one at each top-level parallel route. This is not
longer needed as we have a global one in `app-router.tsx`


<!-- 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 or adding/fixing Examples

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

### Fixing a bug

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

### Adding a feature

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



## For Maintainers

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

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
fixes NEXT-968
2023-04-12 13:27:25 +02:00
Jimmy Lai
5977121e5e
interception routes: add new sibling matcher marker + validation (#48276)
This PR adds a new marker for intercepting siblings routes + adds some
validation to intercepting routes ( you shouldn't use (..) at the top
level!)

also fixes a bug with any interception from `/` when navigating from a
child route

the new marker, `(.)`, makes it easier to model cases like 
```
/profile/[id]
/profile/[id]/photos/[id]/
```

With the current syntax available, you’d need to do:
```with (..):
/profile/[id]/(..)[id]/photos/[id]

with (...):
/profile/[id]/(...)profile/[id]/photos/[id]

with (..)(..):
/profile/[id]/(..)(..)profile/[id]/photos/[id]
```

now, with (.)
```
/profile/[id]/(.)photos/[id]
```

<!-- 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 or adding/fixing 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 #

-->

link NEXT-935
also fixes NEXT-970
fixes NEXT-973
2023-04-12 11:50:01 +02:00
Jimmy Lai
17e44d2907
app-router: add batching support for RSC router payloads (#48253)
This PR basically adds support for processing multiple router payloads.
Previously we were only handling one payload at a time but now that we
introduced parallel routes, we need to be able to render and return
separate parts of the layout separately.

Before, the single payload was generated in a DFS manner: we traversed
the router state and rendered the first segment of the tree that we
found needed rendering. In practice, this meant that we could miss
adjacent segments that might need to be re-rendered as well.

Now, we iterate all branches of the tree and return an array of flight
patches to be applied on the client correctly.

fixes NEXT-971

<!-- 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 or adding/fixing 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-04-12 09:53:13 +02:00
Tobias Koppers
b9618ea620
allow anyone to approve a lockfile change (#48261)
### What?

web-tooling team can approve lockfile changes

### Why?

updating turbopack requires to update the lockfile

### How?

add lockfile to code owners

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Steven <steven@ceriously.com>
2023-04-12 08:42:31 +02:00
Yohei Tsubuku
df16f74f0f
Fix the typo on README.md (#48274)
This is a very tiny fix. I hope it helps.
`examples` → `example`
2023-04-12 02:07:38 +00:00
Shu Ding
c11bce5989
Opt-into worker mode when appDir is enabled (#47857)
This unblocks further optimization opportunities as well as fixes for
systematic problems such as NEXT-227. After this PR, only production
mode of non-app projects will be running on the legacy main process
mode.

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-04-11 22:26:49 +02:00
Steven
7126b066db
chore: split up app-dir-export tests (#48252)
This splits the tests up a little more and avoids the need for env vars
2023-04-11 11:40:10 -07:00
Alex Kirszenberg
ce42173eae
Chunking Refactor pt. 2 (#47961)
See https://github.com/vercel/turbo/pull/4450

This PR updates Turbopack to turbopack-230411.2:

## Miscellaneous

* https://github.com/vercel/turbo/pull/4450 <!-- Alex Kirszenberg -
Chunking Refactor pt. 2 -->
2023-04-11 11:08:37 -07:00
Jiachi Liu
cd55220a6f
Update codeowner for images (#48239)
Add `@huozhi` for images and related as metadata could need them
2023-04-11 17:44:36 +02:00
Már Örlygsson
08b1916126
fix: Shift route-announcer to top of layout parent (#44853)
Without `top: 0` the route announcer triggers subtle layout shift in
Blink/Chrome.

BTW, this mostly (possibly only?) occurs on pages with specific overflow
proprty combinations on `<html/>` and `<body/>`, and only when rendering
inside a custom element like the `<next-route-announcer />` portal.
(Changing the portal into `<div/>` seems to make the layout shift
disappear, but that would be far more invasive change than just adding
`top:0`.)

---------

Co-authored-by: Shu Ding <g@shud.in>
2023-04-11 17:05:09 +02:00
Shu Ding
fb78e61ba0
Fix typeof expression in layout router (#48245)
Fix the `typeof window === undefined` expression.
2023-04-11 16:38:18 +02:00
apeltop
8bacad921b
Fix typo in script.md (#48225)
occuring -> occurring

I hope it helps.

<!-- 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 or adding/fixing 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-04-11 13:26:23 +00:00
Jiachi Liu
83e05e6ee9
Remove warning for metadataBase fallback (#48196)
[slack
thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1681079578508909)

Remove the warning for metadataBase when it fallback to default value,
as it's already clarified in
[docs](https://beta.nextjs.org/docs/api-reference/metadata#metadatabase)
2023-04-11 15:19:40 +02:00
Jan Kaifer
af12a94a28
Docs: Describe how to manually configure open telemetry (#48071)
It's currently not clear that `@vercel/otel` is just a simple wrapper
when you are trying things out. So I added an excellent example of how
to instrument create an OpenTelemetry setup.

The only FUD I have here is that people won't skip that `Manual
OpenTelemetry setup` and try to understand it. But I try to describe
this at the beginning of that section.

I'll also try to update `@vercel/otel` readme to be more transparent on
what it does.
2023-04-11 10:59:00 +00:00
tunamagur0
7f1d7c4fd2
Fix documentation link for transpilePackages in NextConfig (#48121)
The documentation link in NextConfig's JSDoc for 'transpilePackages' was
returning a 404 error.
2023-04-10 21:19:02 +02:00
Hannes Bornö
8b791737e1
Update next/font/google data (#48195)
Updates the `next/font/google` data with
`scripts/update-google-fonts.js`.

Co-authored-by: Hannes Bornö <hannesborno@Hanness-MacBook-Pro.local>
2023-04-10 20:14:28 +02:00
Hannes Bornö
2cb5876b7b
Enable opening source file in build error overlay (#48194)
It's only possible to open the source file in the editor on runtime
errors:
<img width="951" alt="image"
src="https://user-images.githubusercontent.com/25056922/230925905-b6741246-90f3-4c5a-8211-f3b85cc63275.png">

For build errors, the source file is just part of the error message, and
not clickable:
<img width="934" alt="image"
src="https://user-images.githubusercontent.com/25056922/230926579-ba803272-90f5-4366-aec0-176ea6489c3e.png">

This PR makes the source file clickable on build errors as well:
<img width="947" alt="image"
src="https://user-images.githubusercontent.com/25056922/230926886-4ba18f54-be52-49b4-9421-1c6282d823a9.png">

---------

Co-authored-by: Hannes Bornö <hannesborno@Hanness-MacBook-Pro.local>
2023-04-10 20:13:34 +02:00
JJ Kasper
b896a12867 v13.3.1-canary.4 2023-04-10 17:07:34 +00:00
Lucas
9c9fdabbd4
Fix next-flight-loader resourcePath in Windows (#48152)
### What?
It's path backslash and string escape bug at
[next-flight-loader](https://linear.app/vercel/issue/NEXT-flight-loader),
in Windows

### Why?

### How?

Closes NEXT-940
Fixes #47704
2023-04-10 19:01:20 +02:00
Shu Ding
772f3e7509
Add experimental React related warning (#47986)
For now, this isn't a strong requirement as normal `fetch` requests will
still work with `react@next`. But in the future, form related props e.g.
`action=` and `formAction=` requires the experimental build.

Fixes NEXT-954.
2023-04-10 14:37:23 +02:00
Shu Ding
9c0e520896
Re-land "Vendor react@experimental under an experimentalReact flag" (#48041)
Reverts vercel/next.js#48038

fix NEXT-926

---

The root cause was that when copying the package.json, I removed all
fields except for a few (such as `exports`) but missed the `browser`
field. That caused the client bundle to resolve to the Node.js version
of React DOM, and then we had the `async_hooks` error. Added it back in
99c9b9e51f8b0d4e4503ece9d07bce09161f3341.

I reproduced the error with next-site earlier and confirmed that this
fix is good.
2023-04-08 17:16:24 +02:00
JJ Kasper
2bcdfbb6ab v13.3.1-canary.3 2023-04-08 01:47:09 +00:00
JJ Kasper
1caa58962f
Add flag to control app document preloading (#48115)
x-ref: [slack
thread](https://vercel.slack.com/archives/C02EU7CEVB7/p1680910556362999?thread_ts=1680906129.293849&cid=C02EU7CEVB7)
2023-04-07 17:58:47 -07:00
JJ Kasper
4e3f135fd6
Update flakey tests (#48113)
x-ref:
https://github.com/vercel/next.js/actions/runs/4642101338/jobs/8215704290
x-ref:
https://github.com/vercel/next.js/actions/runs/4641810347/jobs/8215208356
x-ref:
https://github.com/vercel/next.js/actions/runs/4640288495/jobs/8212579666
x-ref:
https://github.com/vercel/next.js/actions/runs/4640288495/jobs/8212653308
2023-04-07 17:54:17 -07:00
Jiachi Liu
71a29a17b8
Support og image with edge (#48086)
Fixing edge runtime doesn't work with exports from dynamic metaddata
image routes. If there's a match, don't do extra matching.

Fixes NEXT-866
2023-04-07 16:27:32 -07:00
JJ Kasper
db7b3bdbcf
Remove change leftover from experimental precompiled server (#48107)
This is no longer needed as the experimental precompiled server was
removed.

Closes: https://github.com/vercel/next.js/issues/46588
2023-04-07 15:24:59 -07:00
Nabeel Sulieman
5ea70b85c1
Next Cache Telemetry (#47939)
### What?

Report additional telemetry related to cached fetches:

- Fetch Index number to group related fetches (cache-get, cache-set,
origin)
- Origin URL map cache key to original upstream URL

### Why?

This is needed for fetch cache telemetry on the Vercel platform.

### How?

Telemetry is provided through optional parameters added to the fetch
call configuration. It is similar to the `next: {revalidate: X}` and
`{next: { internal: true }}` fields.

The origin URL and fetch index are calculated in the patch-fetch
function and are passed down to the caching classes as needed. These
fields are optional and ignored by the `FileSystemCache`.
2023-04-07 12:06:04 -07:00
JJ Kasper
b5f785aab1 v13.3.1-canary.2 2023-04-07 18:04:26 +00:00
Shu Ding
6b9af3e0d1
Fix fallback detection logic when multiple generateStaticParams are needed (#47982)
### What?

Our current logic of detecting if a route allows dynamic params or not
(`fallback`) is flawed, and this PR fixes it.

### Why?

Right now, if no `generateStaticParams` is specified we return
`fallback: undefined` during dev. However, for an app with multiple
params, it may have multiple `generateStaticParams` defined in different
levels. If some level isn't covered by any `generateStaticParams`, we
still can't determine the fallback value.

### How?

I added a naive implementation to check if all params are covered by
`generateStaticParams` in the current or inner layers.

Closes NEXT-946
2023-04-07 19:56:40 +02:00
Shu Ding
98dfbc0775
chore: Add .vscode to eslintignore (#48020)
### What?

Add `.vscode` to `.eslintignore`.

### Why?

We ignore `.vscode` folder in our tests, but Next.js itself creates it
so manually running tests locally will causing them to be added. That
causes ESLint to fail because it checks JSON files inside `.vscode`
folder.
2023-04-07 15:51:26 +00:00
Chandrajeet Maurya
536b4dca8c
Update deployment.md (#48062)
Since the code above is referring to `package.json` it should be `npm
run build` and `npm run start` instead of running `next build` and `next
start` directly

<!-- 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 or adding/fixing 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-04-07 08:38:59 -07:00
JJ Kasper
0097c12a92 v13.3.1-canary.1 2023-04-07 13:29:08 +00:00
Jimmy Lai
a71227a40f
parallel routes: fix layout not re-rendering (#48066)
### What?

This PR makes the parent layout of parallel routes re-render when the
parallel route segments are different or when either of them has a
refetch marker.

Example:
```
.
└── app/
    ├── page.ts
    ├── layout.ts
    ├── foo/
    │   └── page.ts
    └── @modal/
        ├── default.js
        └── foo/
            └── page.ts
```

Here if you navigated to `/foo` from `/`, `@modal/foo/page` would never
get re-rendered because the tree would only re-render from
`foo/page.ts`.

This PR adds a check that checks the router state on navigation to see
if the parallel route segments diverge on navigation. Here we would be
checking that `@modal/default` is different from `@modal/page` so we
would re-render.

Also added some logic to make sure that refetch routes are processed
first when handling parallel routes.

### Why?

See example

Closes NEXT-966
Fixes #


<!-- 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 or adding/fixing 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-04-07 15:23:08 +02:00
JJ Kasper
883933b6c5 v13.3.1-canary.0 2023-04-07 03:15:57 +00:00
Justin Ridgewell
10b9355781
turbopack: pass ENV vars to route handlers (#48048)
Same as https://github.com/vercel/next.js/pull/47767, we need to pass
the full list of `process.env` keys to the edge invocation so that the
ENV vars are available to the route handlers.

Fixes https://github.com/vercel/turbo/issues/4489
Fixes https://github.com/vercel/next.js/issues/48036
Fixes WEB-869
Fixes NEXT-961
fix #48036

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-04-06 19:33:55 -07:00
Justin Ridgewell
8d3e42e556
turbopack: bind server to IPv6 loopback (#47948)
This accomplishes 2 things:
1. binds the turbopack dev server to the IPv6 unspecified address
2. initializes our router with the same hostname/port of the turobpack
server

The first matches the behavior of the Node.js dev server. The IPv6
unspecified address is similar to IPv4's `0.0.0.0` address, allowing us
to accept connection from anywhere. Importantly, it _also_ allows
accepting IPv4 connections, making this address truly universal.

The second means the `request` parameter to any middleware will have the
correct origin, and the request's URL can be used to craft fetch
requests to API endpoints. `new URL(req.url).origin` will be the origin
of the turbopack dev server.

Fixes https://github.com/vercel/turbo/issues/4456
Fixes WEB-855
2023-04-06 17:58:26 -07:00
JJ Kasper
40687daed2
Update query param prefix to reduce length (#48051)
With the addition of the query prefix we can hit the max length for PCRE
named matches so this reduces the prefix length and ensures we go
through the param name validation still

x-ref: https://twitter.com/simonecervini/status/1644123851003928579
2023-04-06 17:52:24 -07:00
Steven
690208b11f
fix: show error when "next start" is used with "output" config (#47989)
fix #47334
fix NEXT-861
2023-04-06 17:28:27 -07:00
Jiachi Liu
1e81af047d
Change metadata routes suffix to number and chars (#48026)
Follow up of #47985 

Change `-\d{6}` to `-[a-z0-9]{6}` which reduces the chance of hash
collision
2023-04-06 16:38:02 -07:00
JJ Kasper
fc29a13ad2
Fix query normalize on edge deploy (#48045)
Fixes:
https://github.com/vercel/next.js/actions/runs/4632507508/jobs/8196861461#step:6:464
2023-04-06 15:01:04 -07:00
JJ Kasper
2a68ecf509
Fix stable release start (#48044)
x-ref:
https://github.com/vercel/next.js/actions/runs/4632849191/jobs/8197395820
2023-04-06 14:52:56 -07:00
JJ Kasper
79031e608a
v13.3.0 2023-04-06 13:47:03 -07:00
JJ Kasper
b8e7646fdc v13.2.5-canary.34 2023-04-06 19:48:01 +00:00
Wyatt Johnson
045ad0d133
Replaced Reflect with ReflectAdapter (#48000)
On some runtimes, `Reflect` is not available. This creates a new "naive"
implementation.
2023-04-06 21:18:42 +02:00
JJ Kasper
9448913149
Revert "Vendor react@experimental under an experimentalReact flag" (#48038)
x-ref: [slack
thread](https://vercel.slack.com/archives/C04DUD7EB1B/p1680804950611789?thread_ts=1680791613.468109&cid=C04DUD7EB1B)

Reverts vercel/next.js#47759
fix NEXT-926
2023-04-06 11:48:09 -07:00