Мазмұнға өту
Мақала 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

PatternProblem SolvedPractical Rule
Keep "use client" Leaves SmallBloated JS bundles and slow hydrationFetch data in Server Components; pass serializable props to small interactive islands
Parallel Data FetchingSequential await a(); await b() waterfallsUse Promise.all for independent queries; hoist fetches above conditional branches
Suspense Streaming BoundariesOne slow analytics widget blocking the whole routeStream heavy sub-panels inside <Suspense fallback={<Skeleton />}>
Scoped i18n Message CatalogsShipping 400 KB of unrelated translations per routeLoad 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.

Бұл пайдалы болды ма?