Step 17: No Hydration Issue

The Problem

Without hydration, users have to wait for data to load before seeing any content. This creates a poor user experience with blank screens during data fetching.

Issues:

  • Blank screen during data loading
  • Poor First Contentful Paint (FCP)
  • High Largest Contentful Paint (LCP)
  • No progressive enhancement

Problematic Code:


          @Component({
  template:
    <div *ngIf="cards">
    @for (card of cards; track card.id) {
        <div class="card">...</div>
      }
    </div>
  })
export class Component {
  cards: Card[] | null = null;

  constructor() {
    // Wait for data before showing anything
    this.loadData();
  }
}
          

Refresh the page and notice how there's a 3-second blank screen before any content appears.

Card 1

Card 1

Content only visible after data loads

Card 2

Card 2

Content only visible after data loads

Card 3

Card 3

Content only visible after data loads

Card 4

Card 4

Content only visible after data loads

Card 5

Card 5

Content only visible after data loads

Card 6

Card 6

Content only visible after data loads

Card 7

Card 7

Content only visible after data loads

Card 8

Card 8

Content only visible after data loads

Card 9

Card 9

Content only visible after data loads

Card 10

Card 10

Content only visible after data loads

Card 11

Card 11

Content only visible after data loads

Card 12

Card 12

Content only visible after data loads

Card 13

Card 13

Content only visible after data loads

Card 14

Card 14

Content only visible after data loads

Card 15

Card 15

Content only visible after data loads

Card 16

Card 16

Content only visible after data loads

Card 17

Card 17

Content only visible after data loads

Card 18

Card 18

Content only visible after data loads

Card 19

Card 19

Content only visible after data loads

Card 20

Card 20

Content only visible after data loads