Performance: Streaming long operations
HIGH IMPACT
This affects how quickly users see content during long server operations by sending partial data progressively.
import React from 'react'; export default async function Page() { const stream = fetchLongDataStream(); return ( <div> <React.Suspense fallback={<Loading />}> <StreamingContent stream={stream} /> </React.Suspense> </div> ); }
export default async function Page() { const data = await fetchLongData(); return <div>{data}</div>; }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Blocking full data fetch | Single large DOM update after full data | 1 reflow after full data | High paint cost due to large update | [X] Bad |
| Streaming partial content | Multiple small DOM updates progressively | Multiple small reflows but faster perceived paint | Lower paint cost per chunk | [OK] Good |