0Pricing
Next.js 15 Fullstack (App Router + Server Actions) · Lesson

Streaming Pitfalls: Layout Shift and Waterfalls

Diagnose and fix sequential data waterfalls and visual jumps that degrade streamed pages.

Why Streaming Goes Wrong

Streaming with React Suspense and Next.js 15 is powerful, but it introduces two categories of problems that silently degrade user experience:

  • Layout Shift — the page visually jumps when streamed content arrives and replaces a skeleton or placeholder, causing elements to reposition.
  • Data Waterfalls — components fetch data sequentially rather than in parallel, so the total load time is the sum of all fetch durations instead of the maximum.

These problems are distinct but often appear together. A waterfall delays when content arrives, and when it finally does arrive, a poorly designed skeleton causes a layout shift. This lesson teaches you to diagnose both and apply targeted fixes.

Anatomy of a Data Waterfall

A waterfall happens when one async Server Component awaits its data before rendering children that also need to fetch data. Because the parent suspends first, children never start fetching until the parent resolves.

Consider this structure:

  • DashboardPage awaits getUser() (200 ms)
  • Then renders <RecentOrders userId={user.id} /> which awaits getOrders(userId) (300 ms)
  • Then renders <Recommendations userId={user.id} /> which awaits getRecommendations(userId) (400 ms)

Total wait: 200 + 300 + 400 = 900 ms. With parallel fetches it could be max(200, 300, 400) = 400 ms. The cascade is the waterfall.

All lessons in this course

  1. Suspense Boundaries and Component-Level Streaming
  2. Crafting Meaningful loading.tsx and Skeletons
  3. Partial Prerendering: Static Shell, Dynamic Holes
  4. Streaming Pitfalls: Layout Shift and Waterfalls
← Back to Next.js 15 Fullstack (App Router + Server Actions)