Мақала Kazakh тілінде әлі жарияланбаған. English нұсқасы көрсетілуде.
Next.js App Router Performance: Server Components, Suspense Streaming, and Hydration Budgets
Жарияланды
2 мин оқу
Modern full-stack React applications often grow sluggish not because React is slow, but because teams accidentally mark entire page shells "use client", ship megabytes of charting and editor libraries to landing pages, and run sequential server data waterfalls.
Four High-Impact App Router Patterns
| Pattern | Problem Solved | Practical Rule |
|---|---|---|
Keep "use client" Leaves Small | Bloated JS bundles and slow hydration | Fetch data in Server Components; pass serializable props to small interactive islands |
| Parallel Data Fetching | Sequential await a(); await b() waterfalls | Use Promise.all for independent queries; hoist fetches above conditional branches |
| Suspense Streaming Boundaries | One slow analytics widget blocking the whole route | Stream heavy sub-panels inside <Suspense fallback={<Skeleton />}> |
| Scoped i18n Message Catalogs | Shipping 400 KB of unrelated translations per route | Load route-scoped message namespaces instead of full global JSON bundles |
Eliminating Server Waterfalls
tsx
// Good: fetch independent resources concurrently in a Server Component
export async function WorkspaceOverviewPage({ workspaceId }: { workspaceId: string }) {
const [summary, recentCampaigns, channelHealth] = await Promise.all([
loadWorkspaceSummary(workspaceId),
loadRecentCampaigns(workspaceId),
loadChannelHealth(workspaceId),
]);
return (
<div className="space-y-6">
<SummaryStrip data={summary} />
<ChannelHealthBanner health={channelHealth} />
<CampaignTable rows={recentCampaigns} />
</div>
);
}
Preserving Client Tab State Without Remount Thrash
When users switch between dense dashboard tabs (for example Overview, Campaigns, Sources), unmounting heavy filter state and charts forces jarring refetches on every click. Modern React 19 patterns (such as <Activity mode={active ? "visible" : "hidden"}>) preserve visited panel state cleanly while letting React deprioritize updates inside hidden views.
Next: build ultra-lightweight widgets embedded on third-party customer websites in Engineering Embeddable Web Widgets.
Бұл пайдалы болды ма?