Skip to content

[Fix] 검색 탭 앨범 목록 N+1 요청 제거 (#66) - #68

Merged
ddodle merged 1 commit into
mainfrom
fix/66-album-list-n-plus-one
Aug 17, 2026
Merged

ddodle merged 1 commit into
mainfrom
fix/66-album-list-n-plus-one

Conversation

@ddodle

@ddodle ddodle commented Aug 17, 2026 •

Copy link
Copy Markdown
Collaborator

✨ PR 유형

어떤 변경 사항이 있나요??

  • 새로운 기능 추가
  • 버그 수정
  • 사용자 UI 디자인 변경 및 추가
  • 코드에 영향을 주지 않는 변경사항(오타 수정, 탭 사이즈 변경, 변수명 변경)
  • 코드 리팩토링
  • 주석 추가 및 수정
  • 문서 수정
  • 테스트 추가, 테스트 리팩토링
  • 빌드 부분 혹은 패키지 매니저 수정
  • 파일 혹은 폴더명 수정
  • 파일 혹은 폴더 삭제

🛠️ 작업내용

Closes #66

문제: 검색 탭 진입 시 앨범 카드의 대표 사진·장수를 채우려고 앨범마다 GET /albums/{tagId}/photos를 순차 호출 — 앨범 26개 기준 진입 한 번에 27요청 (목 서버 로그 실측).

수정:

  • GET /albums 응답 계약에 coverImageUrl(nullable)·photoCount 포함 — Album 도메인 모델·AlbumResponseDTO에 반영, 죽은 필드 userId 제거
  • AlbumViewModel의 프리뷰 채우기 루프(albumPreviews)와 AlbumPreview 타입 삭제 (−16줄)
  • AlbumCard가 Album 필드를 직접 사용 — 프리뷰 로딩 전 장수가 비어 보이던 지연도 함께 사라짐
  • Mock 픽스처에 커버·장수 반영, Album 생성자 변경으로 구식 AlbumDetailView #Preview 제거

효과: 검색 탭 진입 시 서버 요청 27회 → 1회

📋 추후 진행 상황

📌 리뷰 포인트

  • photoCount를 non-optional로 디코드하므로, 실서버가 이 필드를 내려주기 전에는 앨범 목록 디코드가 실패함 — 서버 계약 선행 조건
  • coverImageUrl은 사진 없는 앨범을 고려해 optional (String? → URL? 변환은 Data 레이어에서 수행)

✅ Checklist

PR이 다음 요구 사항을 충족하는지 확인해주세요!!!

🤖 Generated with Claude Code

Summary by CodeRabbit

  • 새로운 기능

    • 앨범 목록에 대표 커버 이미지와 사진 개수가 표시됩니다.
    • 커버 이미지가 없는 앨범은 기본 배경으로 표시됩니다.
  • 개선 사항

    • 앨범 목록 표시가 간소화되어 불필요한 추가 사진 조회가 제거되었습니다.
    • 앨범 상세 화면의 개발용 미리보기 요소를 정리했습니다.

- GET /albums 응답 계약에 coverImageUrl(nullable)·photoCount 포함 — Album 모델·DTO 반영, 죽은 필드 userId 제거
- AlbumViewModel의 카드 프리뷰 채우기 루프(albumPreviews)·AlbumPreview 타입 삭제
- AlbumCard가 Album 필드를 직접 사용, 사진 수 표기는 항상 노출
- 검색 탭 진입 시 서버 요청 27회 → 1회 (앨범 26개, 목 서버 로그 실측)
- Album 생성자 변경으로 구식 AlbumDetailView #Preview 제거
@coderabbitai

coderabbitai Bot commented Aug 17, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a0b488ba-f4d8-4218-ba60-654b1f3b002d

📥 Commits

Reviewing files that changed from the base of the PR and between 6aaa8dd and ebe9e77.

📒 Files selected for processing (6)
  • Rephoto_iOS/Features/Search/Data/DTO/AlbumResponseDTO.swift
  • Rephoto_iOS/Features/Search/Domain/Models/Album.swift
  • Rephoto_iOS/Features/Search/Presentation/Preview/MockSearchUseCaseProvider.swift
  • Rephoto_iOS/Features/Search/Presentation/ViewModels/AlbumViewModel.swift
  • Rephoto_iOS/Features/Search/Presentation/Views/AlbumDetailView.swift
  • Rephoto_iOS/Features/Search/Presentation/Views/SearchView.swift
💤 Files with no reviewable changes (2)
  • Rephoto_iOS/Features/Search/Presentation/Views/AlbumDetailView.swift
  • Rephoto_iOS/Features/Search/Presentation/ViewModels/AlbumViewModel.swift

Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review.


Walkthrough

앨범 응답과 도메인 모델에 커버 이미지 URL과 사진 수를 추가했습니다. 앨범별 사진 조회와 프리뷰 상태를 제거했습니다. 검색 화면은 Album 데이터를 직접 사용해 카드 정보를 표시합니다.

Changes

앨범 목록 표시 흐름

Layer / File(s) Summary
앨범 응답 및 도메인 계약
Rephoto_iOS/Features/Search/Data/DTO/AlbumResponseDTO.swift, Rephoto_iOS/Features/Search/Domain/Models/Album.swift, Rephoto_iOS/Features/Search/Presentation/Preview/MockSearchUseCaseProvider.swift
앨범 응답과 Album에 coverImageUrl 및 photoCount를 추가했습니다. 유효하지 않은 이미지 URL은 nil로 변환합니다. Mock 데이터도 새 필드를 설정합니다.
앨범 프리뷰 조회 제거
Rephoto_iOS/Features/Search/Presentation/ViewModels/AlbumViewModel.swift, Rephoto_iOS/Features/Search/Presentation/Views/SearchView.swift
AlbumPreview와 albumPreviews를 제거했습니다. 앨범별 사진 조회 없이 앨범 목록을 화면에 전달합니다.
앨범 카드 직접 표시
Rephoto_iOS/Features/Search/Presentation/Views/SearchView.swift, Rephoto_iOS/Features/Search/Presentation/Views/AlbumDetailView.swift
앨범 카드는 Album의 사진 수와 커버 이미지 URL을 직접 사용합니다. 커버 이미지가 없으면 그라데이션 배경을 표시합니다. DEBUG 전용 상세 화면 프리뷰를 제거했습니다.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: 🔵 Low · up to ebe9e

The album list now requires the backend to provide a non-null photoCount; deploying the app before that contract is available could cause album-list loading failures. The PR is otherwise mergeable with explicit owner awareness and coordinated backend deployment.

Poem

당근 든 토끼가 앨범을 보니
커버와 사진 수가 한 번에 오네
프리뷰 굴레는 사라지고
추가 요청도 줄어드네
깡총, 카드가 직접 웃는다!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 제목이 검색 탭 앨범 목록의 N+1 요청 제거라는 핵심 변경을 정확하고 간결하게 설명합니다.
Description check ✅ Passed PR 설명이 변경 유형, 작업 내용, 후속 작업, 리뷰 포인트와 체크리스트를 대부분 충실히 작성했습니다.
Linked Issues check ✅ Passed #66의 응답 필드 추가, 프리뷰 로직 삭제, Album 직접 사용, 요청 1회화 요구를 모두 반영했습니다.
Out of Scope Changes check ✅ Passed Mock 갱신과 기존 Preview 삭제를 포함한 모든 변경이 Album 데이터 구조 변경과 N+1 제거 목적에 관련됩니다.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/66-album-list-n-plus-one

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ddodle ddodle self-assigned this Aug 17, 2026
@ddodle
ddodle merged commit 52a4e95 into main Aug 17, 2026
2 checks passed
@ddodle
ddodle deleted the fix/66-album-list-n-plus-one branch August 17, 2026 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Bug: 검색 탭 앨범 목록 N+1 요청 (앨범 26개 기준 27요청)

1 participant