mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
Adds a new export from next/cache that acts as a metasyntactic IO boundary. During prerendering with cache components it returns a hanging promise to prevent execution of code that follows it. In all other contexts it resolves as a fulfilled thenable that React can unwrap synchronously. This is gated behind experimental.unstableIO and not ready for general use.
16 lines
358 B
TypeScript
16 lines
358 B
TypeScript
import { unstable_io } from 'next/cache'
|
|
|
|
export default function PagesGSP({ rendered }: { rendered: string }) {
|
|
return (
|
|
<>
|
|
<p>This page uses unstable_io() in getStaticProps.</p>
|
|
<div id="pages-content">{rendered}</div>
|
|
</>
|
|
)
|
|
}
|
|
|
|
export async function getStaticProps() {
|
|
await unstable_io()
|
|
return { props: { rendered: 'ok' } }
|
|
}
|