[Perf] LCP 개선을 위한 Font/Icon/CardTag 컴포넌트 렌더링 최적화 (2.3s → 1.0s)#396
[Perf] LCP 개선을 위한 Font/Icon/CardTag 컴포넌트 렌더링 최적화 (2.3s → 1.0s)#396Chiman2937 merged 4 commits intomainfrom
Conversation
🎨 Storybook Report✨ Story가 변경되었습니다 Chromatic에서 비주얼 변경사항을 확인하세요.
|
🎭 Playwright Report✨ E2E Test가 성공적으로 완료되었습니다. Test 요약 내용을 확인해주세요.
📊 Test Summary
📜 Test Details✅ Passed Tests (3)
|
🚀 PR Preview Report✨ Build가 성공적으로 완료되었습니다. Preview에서 변경사항을 확인하세요.
|
📊 Coverage Report
📉 #396을 main에 병합하면 coverage가 Coverage 요약@@ Coverage Diff @@
## main #396 +/- ##
===========================================
- Coverage 35.24% 34.58% -0.66%
===========================================
Files 264 264 0
Lines 12142 11985 -157
Branches 474 461 -13
===========================================
- Hits 4280 4145 -135
- Misses 7862 7840 -22 영향받은 파일
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
📝 변경 사항
화면 렌더링 지연 문제 개선 변경사항
커밋 히스토리
e2c4832dcff104919f2df1. Pretendard 폰트 CDN Dynamic Subset으로 전환
문제 원인
next/font/local로 Variable 폰트 전체(~2MB)를 로드하고 있어, 폰트 다운로드가 완료될 때까지 텍스트가 흔들리는 현상(FOUT)이 발생했음. 이로 인해 Lighthouse 측정 시 LCP가 Mobile 기준 13.82초, Desktop 기준 2.4초까지 늘어남.수정 1.
src/lib/fonts.ts삭제수정 2.
src/app/layout.tsx- pretendard className 제거수정 3.
src/styles/globals.css- CDN Dynamic Subset import 추가2. card-tag CSS overflow 방식으로 전환
문제 원인
useLayoutEffect+ResizeObserver로 컨테이너 너비를 측정하여 보이는 태그 수를 JS로 계산하는 방식이었음. SSR 시점에는 DOM이 없으므로 클라이언트에서 hydration 이후에야 태그 표시 여부가 결정되어 렌더링 지연 현상이 발생했음.3. 아이콘 SVG sprite → SVGR 방식으로 전환
문제 원인
flexisvg기반 SVG sprite 방식은<use>태그를 사용하여 아이콘을 렌더링함.<use>태그는 브라우저의 SVG 렌더링 엔진이 sprite 파일을 fetch한 이후에야 아이콘이 그려지는 방식으로, SSR 시점 HTML에 아이콘 마크업이 포함되지 않음. 이로 인해 초기 로드 시 아이콘 및 버튼이 제대로 보이지 않고 깜빡이는 현상이 발생했음.개선 결과
변경된 파일 목록
src/lib/fonts.tssrc/app/layout.tsxsrc/styles/globals.csssrc/components/shared/card/card-tags/index.tsxsrc/components/shared/card/card-tags/index.test.tsxsrc/components/icon/index.tsxsrc/components/icon/registry/index.ts🔗 관련 이슈
Closes #
🧪 테스트 방법
📸 스크린샷 (선택)
전/후 비교 영상(뚜렷한 차이 확인을 위해 CPU x4 감속, Slow 4G 적용
_2026_03_24_17_45_24_118.mp4
_2026_03_24_17_46_07_34.mp4
📋 체크리스트
💬 추가 코멘트
CodeRabbit Review는 자동으로 실행되지 않습니다.
Review를 실행하려면 comment에 아래와 같이 작성해주세요