Skip to content

Commit 33f6bff

Browse files
Merge branch 'canary' into prevent-edge-case-in-redirect
2 parents b834f39 + 74166ea commit 33f6bff

File tree

15 files changed

+89
-76
lines changed

15 files changed

+89
-76
lines changed

docs/api-reference/next.config.js/build-target.md

Lines changed: 0 additions & 47 deletions
This file was deleted.

docs/api-reference/next.config.js/compression.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Next.js provides gzip compression to compress rendered content and
44

55
# Compression
66

7-
Next.js provides [**gzip**](https://tools.ietf.org/html/rfc6713#section-3) compression to compress rendered content and static files. Compression only works with the [`server` target](/docs/api-reference/next.config.js/build-target.md#server-target). In general you will want to enable compression on a HTTP proxy like [nginx](https://www.nginx.com/), to offload load from the `Node.js` process.
7+
Next.js provides [**gzip**](https://tools.ietf.org/html/rfc6713#section-3) compression to compress rendered content and static files. In general you will want to enable compression on a HTTP proxy like [nginx](https://www.nginx.com/), to offload load from the `Node.js` process.
88

99
To disable **compression**, open `next.config.js` and disable the `compress` config:
1010

docs/api-reference/next/link.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export default Home
6161
- [`replace`](#replace-the-url-instead-of-push) - Replace the current `history` state instead of adding a new url into the stack. Defaults to `false`
6262
- [`scroll`](#disable-scrolling-to-the-top-of-the-page) - Scroll to the top of the page after a navigation. Defaults to `true`
6363
- [`shallow`](/docs/routing/shallow-routing.md) - Update the path of the current page without rerunning [`getStaticProps`](/docs/basic-features/data-fetching.md#getstaticprops-static-generation), [`getServerSideProps`](/docs/basic-features/data-fetching.md#getserversideprops-server-side-rendering) or [`getInitialProps`](/docs/api-reference/data-fetching/getInitialProps.md). Defaults to `false`
64+
- `locale` - The active locale is automatically prepended. `locale` allows for providing a different locale. When `false` `href` has to include the locale as the default behavior is disabled.
6465

6566
## If the route has dynamic segments
6667

docs/basic-features/environment-variables.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,18 @@ Next.js allows you to set defaults in `.env` (all environments), `.env.developme
109109
110110
## Environment Variables on Vercel
111111
112-
When deploying on [Vercel](https://vercel.com) you can configure secrets in the [Environment Variables](https://vercel.com/docs/v2/build-step#environment-variables) section of the project in the Vercel dashboard.
112+
When deploying your Next.js application to [Vercel](https://vercel.com), Environment Variables can be configured [in the Project Settings](https://vercel.com/docs/environment-variables).
113113
114-
You can still use `.env`, `.env.development` and `.env.production` to add defaults.
114+
All types of Environment Variables should be configured there. Even Environment Variables used in Development – which can be [downloaded onto your local device](https://vercel.com/docs/environment-variables#development-environment-variables) afterwards.
115115
116-
If you've configured [Development Environment Variables](https://vercel.com/docs/v2/build-step#development-environment-variables) you can pull them into a `.env.local` for usage on your local machine using the following command:
116+
If you've configured [Development Environment Variables](https://vercel.com/docs/environment-variables#development-environment-variables) you can pull them into a `.env.local` for usage on your local machine using the following command:
117117
118118
```bash
119119
vercel env pull .env.local
120120
```
121121
122+
When using the Vercel CLI to deploy make sure you add a [`.vercelignore`](https://vercel.com/guides/prevent-uploading-sourcepaths-with-vercelignore?query=vercelignore#allowlist) that includes files that should not be uploaded, generally these are the same files included in `.gitignore`.
123+
122124
## Test Environment Variables
123125
124126
Apart from `development` and `production` environments, there is a 3rd option available: `test`. In the same way you can set defaults for development or production environments, you can do the same with `.env.test` file for testing environment (though this one is not so common as the previous two).

docs/manifest.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,10 +292,6 @@
292292
"title": "CDN Support with Asset Prefix",
293293
"path": "/docs/api-reference/next.config.js/cdn-support-with-asset-prefix.md"
294294
},
295-
{
296-
"title": "Build Target",
297-
"path": "/docs/api-reference/next.config.js/build-target.md"
298-
},
299295
{
300296
"title": "Custom Webpack Config",
301297
"path": "/docs/api-reference/next.config.js/custom-webpack-config.md"

examples/with-why-did-you-render/README.md

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,35 @@
11
# Why did you render
22

3-
This is a simple example of getting [why-did-you-render](https://github.com/welldone-software/why-did-you-render) up and running.
4-
The header component will rerender despite the state staying the same. You can see details in developer console.
3+
This is a simple example of how to use [why-did-you-render](https://github.com/welldone-software/why-did-you-render).
4+
5+
The header component will rerender despite the state staying the same.
6+
7+
You can see `why-did-you-render` console logs about this redundant re-render in the developer console.
8+
9+
## Installation guide
10+
11+
1. add `why-did-you-render` to the project by running:
12+
13+
```
14+
yarn add @welldone-software/why-did-you-render
15+
```
16+
17+
1. Create `scripts/wdyr.js` with the code:
18+
19+
```jsx
20+
import React from 'react'
21+
22+
if (process.env.NODE_ENV === 'development') {
23+
if (typeof window !== 'undefined') {
24+
const whyDidYouRender = require('@welldone-software/why-did-you-render')
25+
whyDidYouRender(React, {
26+
trackAllPureComponents: true,
27+
})
28+
}
29+
}
30+
```
31+
32+
1. import `scripts/wdyr.js` as the first import of `_app`.
533

634
## Deploy your own
735

@@ -20,5 +48,3 @@ yarn create next-app --example with-why-did-you-render with-why-did-you-render-a
2048
```
2149

2250
Deploy it to the cloud with [Vercel](https://vercel.com/new?filter=next.js&utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).
23-
24-
[![Deploy To Now](https://deploy.now.sh/static/button.svg)](https://deploy.now.sh/?repo=https://github.com/vercel/next.js/tree/master/examples/with-why-did-you-render)
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"name": "with-why-did-you-render",
3+
"license": "MIT",
34
"scripts": {
45
"dev": "next",
56
"build": "next build",
67
"start": "next start"
78
},
89
"dependencies": {
9-
"@welldone-software/why-did-you-render": "^4.0.4",
10+
"@welldone-software/why-did-you-render": "^6.0.5",
1011
"next": "latest",
11-
"react": "^16.7.0",
12-
"react-dom": "^16.7.0"
13-
},
14-
"license": "MIT"
12+
"react": "^17.0.1",
13+
"react-dom": "^17.0.1"
14+
}
1515
}

examples/with-why-did-you-render/pages/_app.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
import React from 'react'
2-
import whyDidYouRender from '@welldone-software/why-did-you-render'
3-
4-
if (typeof window !== 'undefined' && process.env.NODE_ENV === 'development') {
5-
whyDidYouRender(React)
6-
}
1+
import '../scripts/wdyr'
72

83
export default function App({ Component, pageProps }) {
94
return <Component {...pageProps} />
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react'
2+
3+
if (process.env.NODE_ENV === 'development') {
4+
if (typeof window !== 'undefined') {
5+
const whyDidYouRender = require('@welldone-software/why-did-you-render')
6+
whyDidYouRender(React, {
7+
trackAllPureComponents: true,
8+
})
9+
}
10+
}

packages/next/client/image.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ type CallLoaderProps = {
109109
quality?: number
110110
}
111111

112-
function callLoader(loaderProps: CallLoaderProps) {
112+
function callLoader(loaderProps: CallLoaderProps): string {
113113
const load = loaders.get(configLoader)
114114
if (load) {
115115
return load({ root: configPath, ...loaderProps })
@@ -446,7 +446,7 @@ export default function Image({
446446

447447
type LoaderProps = CallLoaderProps & { root: string }
448448

449-
function normalizeSrc(src: string) {
449+
function normalizeSrc(src: string): string {
450450
return src[0] === '/' ? src.slice(1) : src
451451
}
452452

0 commit comments

Comments
 (0)