Mention Custom App GIP in UPGRADING (#8647)

This tells the user to check their custom <App> for `getInitialProps` if they previously copied the example.

This should help them leverage automatic static optimization!
This commit is contained in:
Joe Haddad 2019-09-05 22:37:22 -04:00 committed by GitHub
parent 6c01bbd6df
commit 319bc463e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 1 deletions

View file

@ -10,6 +10,33 @@ Next.js 9's dynamic routes are **automatically configured on [Now](https://zeit.
You can read more about [Dynamic Routing here](https://github.com/zeit/next.js#dynamic-routing).
#### Check your Custom <App> (`pages/_app.js`)
If you previously copied the [Custom `<App>`](https://nextjs.org/docs#custom-app) example, you may be able to remove your `getInitialProps`.
Removing `getInitialProps` from `pages/_app.js` (when possible) is important to leverage new Next.js features!
The following `getInitialProps` does nothing and may be removed:
```js
class MyApp extends App {
// Remove me, I do nothing!
static async getInitialProps({ Component, ctx }) {
let pageProps = {}
if (Component.getInitialProps) {
pageProps = await Component.getInitialProps(ctx)
}
return { pageProps }
}
render() {
// ... etc
}
}
```
## Breaking Changes
#### `@zeit/next-typescript` is no longer necessary

View file

@ -11,7 +11,7 @@ This causes **all pages** to be executed on the server -- disabling [Automatic P
Be sure you meant to use `getInitialProps` in `pages/_app`!
There are some valid use cases for this, but it is often better to handle `getInitialProps` on a _per-page_ basis.
If you copied the [Custom `<App>`](https://nextjs.org/docs#custom-app) example, you may be able to remove your `getInitialProps`.
If you previously copied the [Custom `<App>`](https://nextjs.org/docs#custom-app) example, you may be able to remove your `getInitialProps`.
The following `getInitialProps` does nothing and may be removed: