Repository navigation
[perf] 번들·에셋 최적화 및 화면별 LCP·CLS 개선 #180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
8747654
[perf] 일반 페이지 라우트를 lazy()로 분할
You-Hyuk 0c54aea
[perf] 관리자 라우트를 lazy()로 분할
You-Hyuk 13b3225
[perf] SignupPage의 효과 없는 authApi 동적 import 제거
You-Hyuk 4088b03
[perf] X 로고 PNG를 SVG로 교체
You-Hyuk 46aee44
[fix] 캘린더 공연 목록의 없는 포스터 placeholder 참조 제거
You-Hyuk ff4f102
[perf] 아티스트 상세의 공연·발매 조회를 아티스트 조회와 병렬화
You-Hyuk 7571ccb
[perf] 커뮤니티 목록 페이지 전환 시 이전 목록 유지
You-Hyuk 61ec6aa
[test] DayConcertList 포스터 대체·날짜 필터 테스트 추가
You-Hyuk 166ac4a
[perf] 화면 표시용 로고를 96px 이미지로 교체
You-Hyuk 8bebbf8
[fix] 재배포 후 lazy 청크 로드 실패 시 한 번 새로고침
You-Hyuk 1b65189
[fix] 화면 표시용 로고를 3배 해상도 대응 144px로 교체
You-Hyuk 5af95e7
[perf] LCP 후보 포스터를 지연 로드하지 않고 우선 요청
You-Hyuk 21d3c61
[perf] 목록 카드의 Spotify 앨범 커버를 300px 버전으로 요청
You-Hyuk 1b1a362
[perf] Pretendard 폰트 CDN에 preconnect 추가
You-Hyuk d2f6486
[test] Spotify 유틸·ConcertCard priority 로드 테스트 추가
You-Hyuk e78c532
[perf] 공연 소개 이미지를 지연 로드
You-Hyuk 999f798
[perf] 공연 소개 이미지를 대표 포스터 로드 후에 렌더링
You-Hyuk 63b4801
[test] 공연 소개 이미지 지연 렌더링 테스트 추가
You-Hyuk cb9a5f7
[perf] 공연 목록 첫 화면 카드 4장의 포스터를 우선 요청
You-Hyuk 7e23cad
[fix] 페이지 청크 로딩 중 푸터가 밀려나는 레이아웃 이동 수정
You-Hyuk 2c18e36
[perf] 릴리즈 목록 첫 화면 카드 4장의 커버를 우선 요청
You-Hyuk 2460da1
[perf] 아티스트 카드 이미지를 320px로 요청하고 첫 화면 카드를 우선 요청
You-Hyuk a80dd60
[perf] 아티스트·릴리즈 상세 대표 이미지를 우선 요청
You-Hyuk 17c550f
[test] 아티스트 썸네일 유틸·카드 priority 로드 테스트 추가
You-Hyuk 8ccdd11
[fix] 릴리즈 상세 로딩 스켈레톤의 레이아웃 이동 수정
You-Hyuk 8458c7c
[ui] 릴리즈 상세 Spotify 버튼을 모바일에서 가운데 정렬
You-Hyuk 32535ee
[perf] KOPIS 공연 이미지를 https 최종 주소로 바로 요청
You-Hyuk e2d021d
[test] KOPIS 이미지 https 변환 테스트 추가
You-Hyuk e82046e
[perf] 해시 빌드 파일(/assets)을 1년 immutable 캐시로 설정
You-Hyuk 5af897e
[fix] 아티스트 상세 목록·D-day 배너 로딩 중 레이아웃 이동 수정
You-Hyuk 825740c
[test] 아티스트 상세 목록 로딩·D-day 자리표시 테스트 추가
You-Hyuk ea26f1a
[style] 릴리즈 상세 미사용 스켈레톤 클래스 제거
You-Hyuk 15a4280
[fix] 캘린더 공연 포스터 주소가 바뀌면 로드 실패 상태 초기화
You-Hyuk 14606aa
[fix] 커뮤니티 목록 이전 목록 유지를 페이지 이동에만 적용
You-Hyuk 02f40cc
[test] 캘린더 포스터 실패 상태 초기화·커뮤니티 목록 전환 테스트 추가
You-Hyuk 1bfc9c7
[feat] ga_internal 파라미터로 운영자 기기 GA 수집 제외
You-Hyuk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| import { beforeEach, describe, expect, it, vi } from 'vitest' | ||
| import { render, screen } from '@testing-library/react' | ||
| import { QueryClient, QueryClientProvider } from '@tanstack/react-query' | ||
| import { MemoryRouter } from 'react-router-dom' | ||
| import useAuthStore from '@/stores/authStore' | ||
| import useLoginModalStore from '@/stores/loginModalStore' | ||
| import ArtistCard from './ArtistCard' | ||
|
|
||
| vi.mock('@/services/artistApi', () => ({ | ||
| followArtist: vi.fn(), | ||
| unfollowArtist: vi.fn(), | ||
| })) | ||
|
|
||
| const HASH = 'f1e2d3c4b5a60718293a4b5c' | ||
|
|
||
| function makeArtist(overrides = {}) { | ||
| return { | ||
| id: 1, | ||
| name: 'YOASOBI', | ||
| koreanName: '요아소비', | ||
| imageUrl: `https://i.scdn.co/image/ab6761610000e5eb${HASH}`, | ||
| hasUpcomingConcert: false, | ||
| spotifyUrl: null, | ||
| isFollowing: false, | ||
| ...overrides, | ||
| } | ||
| } | ||
|
|
||
| function renderCard(props) { | ||
| const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } }) | ||
| return render( | ||
| <QueryClientProvider client={queryClient}> | ||
| <MemoryRouter> | ||
| <ArtistCard {...props} /> | ||
| </MemoryRouter> | ||
| </QueryClientProvider>, | ||
| ) | ||
| } | ||
|
|
||
| // 아바타 링크가 aria-hidden이라 접근성 트리에서 제외되므로 hidden: true로 조회한다 | ||
| function getAvatar(name) { | ||
| return screen.getByRole('img', { name, hidden: true }) | ||
| } | ||
|
|
||
| beforeEach(() => { | ||
| useAuthStore.setState(useAuthStore.getInitialState(), true) | ||
| useLoginModalStore.setState(useLoginModalStore.getInitialState(), true) | ||
| localStorage.clear() | ||
| }) | ||
|
|
||
| describe('ArtistCard', () => { | ||
| it('640px Spotify 이미지면 320px 버전으로 렌더링', () => { | ||
| const artist = makeArtist() | ||
| renderCard({ artist }) | ||
|
|
||
| expect(getAvatar(artist.name)).toHaveAttribute('src', `https://i.scdn.co/image/ab67616100005174${HASH}`) | ||
| }) | ||
|
|
||
| it('priority를 지정하지 않으면 이미지를 지연 로드', () => { | ||
| const artist = makeArtist() | ||
| renderCard({ artist }) | ||
|
|
||
| const avatar = getAvatar(artist.name) | ||
|
|
||
| expect(avatar).toHaveAttribute('loading', 'lazy') | ||
| expect(avatar).toHaveAttribute('fetchpriority', 'auto') | ||
| }) | ||
|
|
||
| it('priority를 지정하면 이미지를 우선 로드', () => { | ||
| const artist = makeArtist() | ||
| renderCard({ artist, priority: true }) | ||
|
|
||
| const avatar = getAvatar(artist.name) | ||
|
|
||
| expect(avatar).toHaveAttribute('loading', 'eager') | ||
| expect(avatar).toHaveAttribute('fetchpriority', 'high') | ||
| }) | ||
|
|
||
| it.each([false, true])('imageUrl이 없으면 priority가 %s여도 이미지 없음', (priority) => { | ||
| const artist = makeArtist({ imageUrl: null }) | ||
| renderCard({ artist, priority }) | ||
|
|
||
| expect(screen.queryByRole('img', { name: artist.name, hidden: true })).not.toBeInTheDocument() | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.