mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
### What In non-PRR mode, we keep the original behavior that metadata is blocking but stream the rest. Previously we also do the full dynamic rendering for both non-PPR and PPR pages, which is required for PPR pages to discard the postpone cache but not necessary for non-PPR pages. This PR align the behavior as before. Closes NDX-881
36 lines
836 B
TypeScript
36 lines
836 B
TypeScript
import { connection } from 'next/server'
|
|
|
|
/// Page is suspended and being caught by the layout Suspense boundary
|
|
export default function Page() {
|
|
return (
|
|
<div className="container">
|
|
<SuspendedComponent />
|
|
</div>
|
|
)
|
|
}
|
|
|
|
async function SuspendedComponent() {
|
|
await connection()
|
|
await new Promise((resolve) => setTimeout(resolve, 500))
|
|
return (
|
|
<div>
|
|
<div>outer suspended component</div>
|
|
<NestedSuspendedComponent />
|
|
</div>
|
|
)
|
|
}
|
|
|
|
async function NestedSuspendedComponent() {
|
|
await connection()
|
|
await new Promise((resolve) => setTimeout(resolve, 500))
|
|
return <div>nested suspended component</div>
|
|
}
|
|
|
|
export async function generateMetadata() {
|
|
// Slow but static metadata
|
|
await new Promise((resolve) => setTimeout(resolve, 2 * 1000))
|
|
return {
|
|
title: 'dynamic-page - partial',
|
|
}
|
|
}
|