Skip to content

Commit

Permalink
Merge branch 'canary' into fix-36651
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored May 17, 2022
2 parents 578fd2b + c7f2c63 commit 8897ffa
Show file tree
Hide file tree
Showing 58 changed files with 484 additions and 702 deletions.
2 changes: 1 addition & 1 deletion docs/api-reference/next.config.js/runtime-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Place any server-only runtime config under `serverRuntimeConfig`.

Anything accessible to both client and server-side code should be under `publicRuntimeConfig`.

> A page that relies on `publicRuntimeConfig` **must** use `getInitialProps` to opt-out of [Automatic Static Optimization](/docs/advanced-features/automatic-static-optimization.md). Runtime configuration won't be available to any page (or component in a page) without `getInitialProps`.
> A page that relies on `publicRuntimeConfig` **must** use `getInitialProps` or `getServerSideProps` or your application must have a [Custom App](/docs/advanced-features/custom-app.md) with `getInitialProps` to opt-out of [Automatic Static Optimization](/docs/advanced-features/automatic-static-optimization.md). Runtime configuration won't be available to any page (or component in a page) without being server-side rendered.
To get access to the runtime configs in your app use `next/config`, like so:

Expand Down
48 changes: 0 additions & 48 deletions docs/api-reference/next/streaming.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,6 @@ description: Streaming related APIs to build Next.js apps in streaming SSR or wi

The experimental `next/streaming` module provides streaming related APIs to port the existing functionality of Next.js apps to streaming scenarios and facilitate the usage of React Server Components.

## unstable_useWebVitalsReport

Next.js provides an `_app` component-level function, [`reportWebVitals`](docs/advanced-features/measuring-performance), for tracking performance metrics. With Server Components, you may have a pure server-side custom `_app` component (which doesn't run client effects) so the existing API won't work.

With the new `unstable_useWebVitalsReport` API, you're able to track [Core Web Vitals](https://nextjs.org/learn/seo/web-performance) in client components:

```jsx
// pages/_app.js
import { unstable_useWebVitalsReport } from 'next/streaming'

export default function Home() {
unstable_useWebVitalsReport((data) => {
console.log(data)
})

return <div>Home Page</div>
}
```

This method could also be used to replace statically exported `reportWebVitals` functions in your existing `_app`:

```jsx
// pages/_app.server.js
import Layout from '../components/layout.client.js'

export default function App({ children }) {
return <Layout>{children}</Layout>
}
```

```jsx
// components/layout.client.js
import { unstable_useWebVitalsReport } from 'next/streaming'

export default function Layout() {
unstable_useWebVitalsReport((data) => {
console.log(data)
})

return (
<div className="container">
<h1>Hello</h1>
<div className="main">{children}</div>
</div>
)
}
```

## unstable_useRefreshRoot

Since Server Components are rendered on the server-side, in some cases you might need to partially refresh content from the server.
Expand Down
23 changes: 23 additions & 0 deletions docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,29 @@ Next.js will automatically load the latest version of your application in the ba

**Note:** If a new page (with an old version) has already been prefetched by `next/link`, Next.js will use the old version. Navigating to a page that has _not_ been prefetched (and is not cached at the CDN level) will load the latest version.

## Manual Graceful shutdowns

Sometimes you might want to run some cleanup code on process signals like `SIGTERM` or `SIGINT`.

You can do that by setting the env variable `NEXT_MANUAL_SIG_HANDLE` to `true` and then register a handler for that signal inside your `_document.js` file.

```js
// pages/_document.js

if (process.env.NEXT_MANUAL_SIG_HANDLE) {
// this should be added in your custom _document
process.on('SIGTERM', () => {
console.log('Received SIGTERM: ', 'cleaning up')
process.exit(0)
})

process.on('SIGINT', () => {
console.log('Received SIGINT: ', 'cleaning up')
process.exit(0)
})
}
```

## Related

For more information on what to do next, we recommend the following sections:
Expand Down
24 changes: 0 additions & 24 deletions errors/client-flush-effects.md

This file was deleted.

8 changes: 0 additions & 8 deletions errors/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -638,14 +638,6 @@
"title": "opening-an-issue",
"path": "/errors/opening-an-issue.md"
},
{
"title": "multiple-flush-effects",
"path": "/errors/multiple-flush-effects.md"
},
{
"title": "client-flush-effects",
"path": "/errors/client-flush-effects.md"
},
{
"title": "import-next",
"path": "/errors/import-next.md"
Expand Down
9 changes: 0 additions & 9 deletions errors/multiple-flush-effects.md

This file was deleted.

2 changes: 1 addition & 1 deletion examples/with-supertokens/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"next": "latest",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"supertokens-auth-react": "^0.20.2",
"supertokens-auth-react": "^0.21.2",
"supertokens-node": "^9.1.1"
}
}
Loading

0 comments on commit 8897ffa

Please sign in to comment.