Skip to content

Largest Contentful Paint 점수 개선 #566

Description

@sungwonnoh

Spectator LCP 개선 이슈

현재 문제

Lighthouse 보고서 기준 spectator 홈의 LCP는 15.2s로 측정됨.

  • URL: https://www.hufscheer.com/soccer?org=9
  • Performance score: 67
  • LCP 요소: 2026 제24회 고황컵_축구
  • 코드 위치: apps/spectator/src/app/[sport]/(home)/_components/tab.tsx

LCP 요소는 이미지가 아니라 홈 화면의 리그명 텍스트다.

LCP에 영향을 주는 요소

1. 홈 핵심 콘텐츠가 client-only 렌더링됨

apps/spectator/src/app/[sport]/(home)/page.tsx

<Suspense clientOnly fallback={<Spinner />}>
  <RecentTab />
</Suspense>

리그명과 경기 목록이 초기 HTML에 포함되지 않고, 클라이언트 렌더링과 API fetch 이후에 표시된다.

단, RecentTab을 그대로 clientOnly 밖으로 빼는 것은 안전하지 않다. 현재 RecentTabuseParams, useRouter, useOrganizationId, useTracker, React Query suspense에 의존하는 client component이므로, LCP에 필요한 읽기 전용 UI만 서버 렌더링 경로로 분리해야 한다.

2. 리그명 렌더링이 API fetch에 의존함

apps/spectator/src/app/[sport]/(home)/_components/tab.tsx

  • useSuspenseLeagueRecentGames
  • useSuspenseLeagueCheerCount

특히 cheer-count는 LCP 텍스트와 같은 렌더 경로에 있어 리그명 표시를 늦출 수 있다.

3. 폰트 파일이 너무 큼

apps/spectator/src/app/_fonts/PretendardVariable.woff2

  • Lighthouse 기준 약 2.06MB
  • LCP 요소가 텍스트라 폰트 전송량이 점수에 불리할 수 있음

4. 이미지 최적화가 꺼져 있음

apps/spectator/next.config.ts

images: {
  unoptimized: true;
}

팀 로고가 작은 크기로 표시되지만 큰 원본 이미지가 내려오고 있음. LCP 직접 요소는 아니지만 전체 payload와 성능 점수에 영향.

해야 할 일

P0

  • RecentTab 에서 리그명/첫 경기 목록을 렌더하는 서버 컴포넌트를 새로 분리
  • 서버 컴포넌트에서 params.sport, searchParams.org를 읽고 fetchLeagueRecentGames로 최근 경기 데이터를 가져오도록 변경
  • 리그명과 첫 경기 목록이 초기 서버 HTML에 포함되도록 구성
  • useRouter, useTracker, useOrganizationId가 필요한 버튼 액션 영역은 별도 client component로 유지
  • cheer-count를 리그명 렌더와 분리하고, 별도 client component 또는 별도 Suspense로 처리

P1

  • Pretendard font subset 적용 또는 필요한 weight만 분리 로드
  • 폰트 파일 cache header 확인

P2

  • images.unoptimized: true 제거 가능 여부 검토
    • 이미지 최적화가 활성화된 뒤 팀 로고 Imagesizes="28px" 추가
  • 팀 로고 썸네일/CDN 리사이즈 적용
  • images.hufscheer.com 이미지 cache header 개선

P3

  • cheer-count 분리 작업과 함께 @number-flow/react를 LCP 경로에서 제거
  • analytics/third-party script가 초기 렌더에 주는 영향 확인

검증

동일 URL로 Lighthouse mobile 재측정:

https://www.hufscheer.com/soccer?org=9

확인 항목:

  • LCP
  • Speed Index
  • Total byte weight
  • Image delivery insight
  • Cache insight

참고

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions