Skip to content

fix: 지금 뜨는 글 조회 N + 1 문제 - #929

Merged
devfeijoa merged 4 commits into
developfrom
fix/925
Aug 1, 2026
Merged

fix: 지금 뜨는 글 조회 N + 1 문제#929
devfeijoa merged 4 commits into
developfrom
fix/925

Conversation

@devfeijoa

@devfeijoa devfeijoa commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

📌𝘐𝘴𝘴𝘶𝘦𝘴

📎𝘞𝘰𝘳𝘬 𝘋𝘦𝘴𝘤𝘳𝘪𝘱𝘵𝘪𝘰𝘯

  • PopularFeedsResponseDto.kt: feedContent, isPublic, novelTitle, novelImage 필드를 Non-nullable로 변경하고, 기존의 title, novelThumbnailImage 대신 novelGenre 필드 추가
  • FeedMapper.kt: 변경된 DTO 구조에 맞춰 매핑 로직 수정 및 novelGenre 매핑 추가
  • FeedRepository.kt: 개별 피드 상세 정보를 반복 호출하던 fetchPopularFeedsWithDetails 함수를 삭제하고, fetchPopularFeeds 내에서 유효한 피드만 필터링하도록 로직 간소화
  • HomeViewModel.kt: 상세 정보 조회가 통합된 feedRepository.fetchPopularFeeds를 호출하도록 수정 및 이에 따른 데이터 접근 방식 변경하여 상세 조회 하던 문제 해결

📷𝘚𝘤𝘳𝘦𝘦𝘯𝘴𝘩𝘰𝘵

Screen_recording_20260730_012524.mp4

💬𝘛𝘰 𝘙𝘦𝘷𝘪𝘦𝘸𝘦𝘳𝘴

변경 된 api에 맞춰 수정하여 지금 뜨는 글 조회 N+1 되는 문제 해결

Summary by CodeRabbit

  • 개선 사항
    • 인기 피드에서 공개 상태와 작품 제목·이미지·장르가 유효한 항목만 표시됩니다.
    • 인기 피드 정보에 작품 장르가 새롭게 제공됩니다.
    • 작품 제목, 이미지 등 주요 정보가 원격 데이터 기준으로 정확하게 반영됩니다.
    • 로그인 및 비로그인 홈 화면에서 인기 피드가 동일한 기준으로 표시됩니다.

- `PopularFeedsResponseDto.kt`: `feedContent`, `isPublic`, `novelTitle`, `novelImage` 필드를 Non-nullable로 변경하고, 기존의 `title`, `novelThumbnailImage` 대신 `novelGenre` 필드 추가
- `FeedMapper.kt`: 변경된 DTO 구조에 맞춰 매핑 로직 수정 및 `novelGenre` 매핑 추가
- `FeedRepository.kt`: 개별 피드 상세 정보를 반복 호출하던 `fetchPopularFeedsWithDetails` 함수를 삭제하고, `fetchPopularFeeds` 내에서 유효한 피드만 필터링하도록 로직 간소화
- `HomeViewModel.kt`: 상세 정보 조회가 통합된 `feedRepository.fetchPopularFeeds`를 호출하도록 수정 및 이에 따른 데이터 접근 방식 변경
@devfeijoa
devfeijoa requested a review from Sadturtleman July 29, 2026 16:26
@devfeijoa devfeijoa self-assigned this Jul 29, 2026
@devfeijoa devfeijoa added 🔨 [FIX] 버그를 수정합니다. [👸 공주 은영] labels Jul 29, 2026
@github-actions
github-actions Bot requested review from m6z1 and s9hn July 29, 2026 16:27
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@devfeijoa, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 30 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: eb7edd22-77e2-45dd-af97-348878886a3d

📥 Commits

Reviewing files that changed from the base of the PR and between 3f94b98 and 86e8975.

📒 Files selected for processing (2)
  • app/src/main/java/com/into/websoso/data/mapper/FeedMapper.kt
  • app/src/main/java/com/into/websoso/data/remote/response/PopularFeedsResponseDto.kt

Walkthrough

인기 피드 응답 필드와 엔티티 구조를 변경했습니다. 저장소는 상세 조회 없이 유효한 피드 목록을 반환합니다. 홈 화면의 로그인, 비로그인, 갱신 경로는 새 목록 조회를 사용합니다.

Changes

인기 피드 조회 흐름

Layer / File(s) Summary
응답 계약과 엔티티 매핑
app/src/main/java/com/into/websoso/data/remote/response/PopularFeedsResponseDto.kt, app/src/main/java/com/into/websoso/data/model/PopularFeedEntity.kt, app/src/main/java/com/into/websoso/data/mapper/FeedMapper.kt
novelGenre를 추가하고 기존 필드를 정리했습니다. 응답의 non-null 필드와 원격 값을 PopularFeedEntity에 직접 매핑합니다.
저장소 조회 및 필터링
app/src/main/java/com/into/websoso/data/repository/FeedRepository.kt
공개 상태이며 소설 제목, 이미지, 장르가 비어 있지 않은 피드만 반환합니다. 항목별 상세 조회 메서드를 제거했습니다.
홈 화면 인기 피드 연결
app/src/main/java/com/into/websoso/ui/main/home/HomeViewModel.kt, app/src/main/java/com/into/websoso/ui/main/home/adpater/PopularFeedsAdapter.kt, app/src/main/java/com/into/websoso/ui/main/home/adpater/PopularFeedsViewHolder.kt, app/src/main/java/com/into/websoso/ui/main/home/model/HomeUiState.kt
홈 화면의 인기 피드 타입을 독립 PopularFeedEntity로 변경했습니다. 로그인, 비로그인, 갱신 경로에서 fetchPopularFeeds()를 호출합니다.

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

Possibly related PRs

Suggested reviewers: m6z1, s9hn

Poem

Poem

토끼가 새 피드 목록을 살펴요
장르와 제목을 빠짐없이 담아요
상세 조회는 한 번에 줄이고
필요한 글만 골라내요
홈 화면으로 깡충 연결해요

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 제목은 지금 뜨는 글 조회의 N+1 문제를 해결하는 주요 변경 사항을 정확하게 설명합니다.
Description check ✅ Passed 설명은 연결 이슈, 주요 파일 변경, 문제 해결 내용, 스크린샷, 리뷰어 안내를 포함합니다.
Linked Issues check ✅ Passed PR은 이슈 #925의 N+1 문제를 반복 상세 조회 제거와 통합된 인기 피드 조회로 해결합니다.
Out of Scope Changes check ✅ Passed 변경 사항은 이슈 #925와 PR 목표인 인기 피드 조회 구조 개선 범위에 포함됩니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/925

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.

Comment thread app/src/main/java/com/into/websoso/data/repository/FeedRepository.kt Outdated
Comment thread app/src/main/java/com/into/websoso/ui/main/home/HomeViewModel.kt
Comment thread app/src/main/java/com/into/websoso/ui/main/home/HomeViewModel.kt Outdated
- `PopularFeedsEntity.kt`: 불필요한 래퍼 클래스인 `PopularFeedsEntity`를 삭제하고, 내부 `PopularFeedEntity`를 별도 파일로 분리
- `FeedMapper.kt`: `toData` 함수의 반환 타입을 `PopularFeedsEntity`에서 `List<PopularFeedEntity>`로 수정
- `FeedRepository.kt`: `fetchPopularFeeds`의 반환 타입을 리스트로 변경하고, 필터링 로직을 리스트 확장 함수를 사용하는 방식으로 간소화
- `HomeViewModel.kt`: 래퍼 클래스 제거에 따라 `popularFeeds` 데이터 접근 로직 수정
- `HomeUiState.kt`, `PopularFeedsAdapter.kt`, `PopularFeedsViewHolder.kt`: 참조하던 `PopularFeedsEntity.PopularFeedEntity` 타입을 `PopularFeedEntity`로 업데이트

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
app/src/main/java/com/into/websoso/data/model/PopularFeedEntity.kt (1)

3-13: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

feesContentfeedContent로 변경하세요.

Line 5의 feesContent는 원격 응답의 feedContent와 다릅니다. 이 이름은 PopularFeedEntity 소비자에 오탈자를 노출합니다. 필드명을 feedContent로 변경하고 FeedMapper.kt Line 113의 명명 인자도 함께 변경하세요.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/src/main/java/com/into/websoso/data/model/PopularFeedEntity.kt` around
lines 3 - 13, Rename the PopularFeedEntity field feesContent to feedContent, and
update the corresponding named argument in FeedMapper.kt to use feedContent so
the model matches the remote response and its consumers.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@app/src/main/java/com/into/websoso/data/model/PopularFeedEntity.kt`:
- Around line 3-13: Rename the PopularFeedEntity field feesContent to
feedContent, and update the corresponding named argument in FeedMapper.kt to use
feedContent so the model matches the remote response and its consumers.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cc1da43b-4a08-45ca-b459-97923323df0d

📥 Commits

Reviewing files that changed from the base of the PR and between 3923aea and 3f94b98.

📒 Files selected for processing (8)
  • app/src/main/java/com/into/websoso/data/mapper/FeedMapper.kt
  • app/src/main/java/com/into/websoso/data/model/PopularFeedEntity.kt
  • app/src/main/java/com/into/websoso/data/model/PopularFeedsEntity.kt
  • app/src/main/java/com/into/websoso/data/repository/FeedRepository.kt
  • app/src/main/java/com/into/websoso/ui/main/home/HomeViewModel.kt
  • app/src/main/java/com/into/websoso/ui/main/home/adpater/PopularFeedsAdapter.kt
  • app/src/main/java/com/into/websoso/ui/main/home/adpater/PopularFeedsViewHolder.kt
  • app/src/main/java/com/into/websoso/ui/main/home/model/HomeUiState.kt
💤 Files with no reviewable changes (1)
  • app/src/main/java/com/into/websoso/data/model/PopularFeedsEntity.kt

- `PopularFeedsResponseDto.kt`: `feedContent` 필드를 nullable(`String?`)로 변경하고 기본값을 `null`로 설정
- `FeedMapper.kt`: `PopularFeedEntity` 변환 시 `feedContent`가 null인 경우 빈 문자열을 반환하도록 `orEmpty()` 적용
- `FeedMapper.kt`: `PopularFeedsResponseDto.toData` 함수에서 `feedContent`가 null이거나 공백인 항목을 리스트에서 제외하도록 `mapNotNull` 및 `isNotBlank` 필터링 로직 적용
@devfeijoa
devfeijoa merged commit c003a49 into develop Aug 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[👸 공주 은영] 🔨 [FIX] 버그를 수정합니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: 지금 뜨는 글 조회 N + 1 문제

2 participants