Skip to content

Commit

Permalink
Mention Custom App GIP in UPGRADING (vercel#8647)
Browse files Browse the repository at this point in the history
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!
  • Loading branch information
Timer authored Sep 6, 2019
1 parent 6c01bbd commit 319bc46
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 27 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion errors/opt-out-automatic-prerendering.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down

0 comments on commit 319bc46

Please sign in to comment.