Skip to content

Commit d882975

Browse files
authored
Merge branch 'canary' into bugfix/fix-example-cms-contentful
2 parents c829474 + cfa8ab9 commit d882975

File tree

145 files changed

+1897
-607
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+1897
-607
lines changed

.github/ISSUE_TEMPLATE/1.bug_report.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ body:
1414
- type: markdown
1515
attributes:
1616
value: 'next@canary is the beta version of Next.js. It includes all features and fixes that are pending to land on the stable release line.'
17+
- type: textarea
18+
attributes:
19+
label: Run `next info` (available from version 12.0.8 and up)
20+
description: Please run `next info` in the root directory of your project and paste the results. You might need to use `npx --no-install next info` if next is not in the current PATH.
21+
validations:
22+
required: false
1723
- type: input
1824
attributes:
1925
label: What version of Next.js are you using?

.github/workflows/build_test_deploy.yml

Lines changed: 141 additions & 136 deletions
Large diffs are not rendered by default.

.github/workflows/stale.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ jobs:
1414
with:
1515
only-labels: 'please add a complete reproduction'
1616
close-issue-message: 'This issue has been automatically closed after 30 days of inactivity with no reproduction. If you are running into a similar issue, please open a new issue with a reproduction. Thank you.'
17-
days-before-issue-close: 30
17+
days-before-issue-close: 1
18+
days-before-issue-stale: 30
1819
days-before-pr-close: -1
1920
days-before-pr-stale: -1
2021
exempt-issue-labels: 'blocked,must,should,keep'

docs/advanced-features/measuring-performance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export function reportWebVitals(metric) {
164164
> ```js
165165
> export function reportWebVitals({ id, name, label, value }) {
166166
> // Use `window.gtag` if you initialized Google Analytics as this example:
167-
> // https://github.com/vercel/next.js/blob/canary/examples/with-google-analytics/pages/_document.js
167+
> // https://github.com/vercel/next.js/blob/canary/examples/with-google-analytics/pages/_app.js
168168
> window.gtag('event', name, {
169169
> event_category:
170170
> label === 'web-vital' ? 'Web Vitals' : 'Next.js custom metric',

docs/advanced-features/react-18.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Ensure you have the `rc` npm tag of React installed:
1212
npm install next@latest react@rc react-dom@rc
1313
```
1414

15+
That's all! You can now start using React 18's new APIs like `startTransition` and `Suspense` in Next.js.
16+
1517
### Enable SSR Streaming (Alpha)
1618

1719
Concurrent features in React 18 include built-in support for server-side Suspense and SSR streaming support, allowing you to server-render pages using HTTP streaming.

docs/api-reference/cli.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Usage
2121
$ next <command>
2222

2323
Available commands
24-
build, start, export, dev, lint, telemetry
24+
build, start, export, dev, lint, telemetry, info
2525

2626
Options
2727
--version, -v Version number
@@ -125,3 +125,36 @@ Next.js collects **completely anonymous** telemetry data about general usage.
125125
Participation in this anonymous program is optional, and you may opt-out if you'd not like to share any information.
126126

127127
To learn more about Telemetry, [please read this document](https://nextjs.org/telemetry/).
128+
129+
## Info
130+
131+
`next info` prints relevant details about the current system which can be used to report Next.js bugs.
132+
This information includes Operating System platform/arch/version, Binaries (Node.js, npm, Yarn, pnpm) and npm package versions (`next`, `react`, `react-dom`).
133+
134+
Running the following in your project's root directory:
135+
136+
```bash
137+
next info
138+
```
139+
140+
will give you information like this example:
141+
142+
```bash
143+
144+
Operating System:
145+
Platform: linux
146+
Arch: x64
147+
Version: #22-Ubuntu SMP Fri Nov 5 13:21:36 UTC 2021
148+
Binaries:
149+
Node: 16.13.0
150+
npm: 8.1.0
151+
Yarn: 1.22.17
152+
pnpm: 6.24.2
153+
Relevant packages:
154+
next: 12.0.8
155+
react: 17.0.2
156+
react-dom: 17.0.2
157+
158+
```
159+
160+
This information should then be pasted into GitHub Issues.

docs/api-reference/next/link.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ The default behavior of the `Link` component is to `push` a new URL into the `hi
204204
The default behavior of `Link` is to scroll to the top of the page. When there is a hash defined it will scroll to the specific id, like a normal `<a>` tag. To prevent scrolling to the top / hash `scroll={false}` can be added to `Link`:
205205

206206
```jsx
207-
<Link href="/?counter=10" scroll={false}>
207+
<Link href="/#hashid" scroll={false}>
208208
<a>Disables scrolling to the top</a>
209209
</Link>
210210
```

docs/basic-features/eslint.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ Next.js provides an ESLint plugin, [`eslint-plugin-next`](https://www.npmjs.com/
9090
| ✔️ | [next/no-head-import-in-document](https://nextjs.org/docs/messages/no-head-import-in-document) | Disallow importing next/head in pages/document.js |
9191
| ✔️ | [next/no-html-link-for-pages](https://nextjs.org/docs/messages/no-html-link-for-pages) | Prohibit HTML anchor links to pages without a Link component |
9292
| ✔️ | [next/no-img-element](https://nextjs.org/docs/messages/no-img-element) | Prohibit usage of HTML &lt;img&gt; element |
93+
| ✔️ | [next/no-head-element](https://nextjs.org/docs/messages/no-head-element) | Prohibit usage of HTML &lt;head&gt; element |
9394
| ✔️ | [next/no-page-custom-font](https://nextjs.org/docs/messages/no-page-custom-font) | Prevent page-only custom fonts |
9495
| ✔️ | [next/no-sync-scripts](https://nextjs.org/docs/messages/no-sync-scripts) | Forbid synchronous scripts |
9596
| ✔️ | [next/no-title-in-document-head](https://nextjs.org/docs/messages/no-title-in-document-head) | Disallow using &lt;title&gt; with Head from next/document |
@@ -202,11 +203,15 @@ Then, add `prettier` to your existing ESLint config:
202203
If you would like to use `next lint` with [lint-staged](https://github.com/okonet/lint-staged) to run the linter on staged git files, you'll have to add the following to the `.lintstagedrc.js` file in the root of your project in order to specify usage of the `--file` flag.
203204

204205
```js
206+
const path = require('path')
207+
208+
const buildEslintCommand = (filenames) =>
209+
`next lint --fix --file ${filenames
210+
.map((f) => path.relative(process.cwd(), f))
211+
.join(' --file ')}`
212+
205213
module.exports = {
206-
'**/*.js?(x)': (filenames) =>
207-
`next lint --fix --file ${filenames
208-
.map((file) => file.split(process.cwd())[1])
209-
.join(' --file ')}`,
214+
'*.{js,jsx,ts,tsx}': [buildEslintCommand],
210215
}
211216
```
212217

errors/manifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@
447447
"path": "/errors/link-multiple-children.md"
448448
},
449449
{ "title": "no-img-element", "path": "/errors/no-img-element.md" },
450+
{ "title": "no-head-element", "path": "/errors/no-head-element.md" },
450451
{
451452
"title": "non-dynamic-getstaticpaths-usage",
452453
"path": "/errors/non-dynamic-getstaticpaths-usage.md"

errors/no-head-element.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# No Head Element
2+
3+
### Why This Error Occurred
4+
5+
An HTML `<head>` element was used to include page-level metadata, but this can cause unexpected behavior in a Next.js application. Use Next.js' built-in `<Head />` component instead.
6+
7+
### Possible Ways to Fix It
8+
9+
Import and use the `<Head />` component:
10+
11+
```jsx
12+
import Head from 'next/head'
13+
14+
function Index() {
15+
return (
16+
<>
17+
<Head>
18+
<title>My page title</title>
19+
<meta name="viewport" content="initial-scale=1.0, width=device-width" />
20+
</Head>
21+
</>
22+
)
23+
}
24+
25+
export default Index
26+
```
27+
28+
### Useful Links
29+
30+
- [next/head](https://nextjs.org/docs/api-reference/next/head)

0 commit comments

Comments
 (0)