| 1 | import { Suspense } from "react"; |
| 2 | |
| 3 | export const dynamic = "force-dynamic"; |
| 4 | |
| 5 | async function Slow() { |
| 6 | // Long enough that the shell flushes first, short enough to keep the |
| 7 | // suite fast. |
| 8 | await new Promise((resolve) => setTimeout(resolve, 700)); |
| 9 | return <p>STREAMING_RESOLVED_MARKER</p>; |
| 10 | } |
| 11 | |
| 12 | // Streaming SSR: the initial HTML shell carries the Suspense fallback and |
| 13 | // the resolved content arrives later in the same (chunked) response. |
| 14 | export default function Streaming() { |
| 15 | return ( |
| 16 | <main> |
| 17 | <h1>STREAMING_PAGE_MARKER</h1> |
| 18 | <Suspense fallback={<p>STREAMING_SUSPENSE_MARKER</p>}> |
| 19 | <Slow /> |
| 20 | </Suspense> |
| 21 | </main> |
| 22 | ); |
| 23 | } |