Skip to content

feat: 일반 검색 개선#874

Merged
m6z1 merged 2 commits into
developfrom
feat/872
Apr 30, 2026
Merged

feat: 일반 검색 개선#874
m6z1 merged 2 commits into
developfrom
feat/872

Conversation

@m6z1
Copy link
Copy Markdown
Member

@m6z1 m6z1 commented Apr 30, 2026

📌𝘐𝘴𝘴𝘶𝘦𝘴

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

  • 일반 검색 플레이스 홀더 추가
  • 소소픽 일반 검색 검색바 아래로 이동

📷𝘚𝘤𝘳𝘦𝘦𝘯𝘴𝘩𝘰𝘵

Screenshot_20260430_193504 Screenshot_20260430_193458

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

Summary by CodeRabbit

변경 사항

  • 리팩토링
    • Soso 추천 섹션이 사용자 인터페이스에서 재구성되었습니다.
    • 이제 검색을 수행하는 동안 Soso 추천 항목이 자동으로 숨겨지며, 검색을 종료하면 다시 표시됩니다.

m6z1 and others added 2 commits April 20, 2026 19:43
검색 실행 전에는 표시되고, 검색 후에는 숨김 처리.
취소 버튼으로 검색어 지우면 다시 표시.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 30, 2026

Walkthrough

이 변경사항은 '소소 픽' 기능을 ExploreFragment에서 NormalExploreActivity로 이전합니다. ViewModel에 새로운 LiveData 속성을 추가하고, Activity에서 이를 관찰하여 RecyclerView를 구성하며, 레이아웃을 그에 따라 조정합니다.

Changes

Cohort / File(s) Summary
ExploreFragment 제거
app/src/main/java/com/into/websoso/ui/main/explore/ExploreFragment.kt, app/src/main/res/layout/fragment_explore.xml
SosoPickAdapter 인스턴스화, ViewModel 상태 관찰, 리로드 버튼 처리 및 soso_pick 네비게이션 콜백 제거. 레이아웃에서 소소 픽 UI 블록(58줄) 제거.
NormalExploreActivity 추가
app/src/main/java/com/into/websoso/ui/normalExplore/NormalExploreActivity.kt, app/src/main/res/layout/activity_normal_explore.xml
새로운 SosoPickAdapter를 통해 RecyclerView 연결, sosoPicks LiveData 관찰, soso_pick 선택 시 throttled 네비게이션 콜백 추가. 레이아웃에 조건부 표시 소소 픽 섹션 추가(66줄).
NormalExploreViewModel 확장
app/src/main/java/com/into/websoso/ui/normalExplore/NormalExploreViewModel.kt
NovelRepository 주입 추가, sosoPicks 및 isSosoPickVisible LiveData 속성 추가, 검색 상태에 따른 소소 픽 가시성 토글 로직 추가.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • fix: 검색 빈 화면 클릭 시 오류 해결 #822: NormalExploreViewModel의 updateSearchResult 메서드의 검색 조건 검증 로직과 관련되어 있으며, 주요 PR의 검색 상태 기반 소소 픽 표시 토글 로직과 상호작용합니다.
  • feat: 작가 모아보기 기능 #826: 동일한 파일들(NormalExploreActivity, NormalExploreViewModel)을 수정하며 SavedStateHandle 지원과 저자 검색 기능을 추가하므로 코드 레벨에서 관련이 있습니다.

Suggested labels

🍯 [FEAT], 🏹 궁사 명지

Suggested reviewers

  • devfeijoa
  • Sadturtleman

Poem

🐰 소소한 픽을 옮기는 일,
Fragment 안녕, Activity 환영!
ViewModel 손에 손잡고,
LiveData 스트림 따라 춤을 춘다네.
검색이 오면 숨고, 지우면 나타나고,
우리의 코드는 더욱 멋진 구조로! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목은 '일반 검색 개선'으로 변경 내용의 핵심(검색 바 아래 소소픽 이동, 플레이스홀더 추가)을 정확히 반영합니다.
Description check ✅ Passed PR 설명은 템플릿을 따르며 이슈 번호, 작업 설명, 스크린샷을 모두 포함하고 있습니다.
Linked Issues check ✅ Passed 코드 변경사항이 이슈 #872의 목표와 일치합니다: 검색 바에 플레이스홀더 추가, 소소픽을 ExploreFragment에서 NormalExploreActivity로 이동.
Out of Scope Changes check ✅ Passed 모든 코드 변경사항이 이슈 #872의 범위 내에 있습니다: 플레이스홀더 추가 및 소소픽 UI 이동만 포함되어 있습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 feat/872

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
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@app/src/main/java/com/into/websoso/ui/normalExplore/NormalExploreViewModel.kt`:
- Around line 113-117: updateSearchWordEmpty currently only clears the query and
toggles _isSosoPickVisible, but it doesn't clear the stored search results so
the previous list remains; inside updateSearchWordEmpty (and/or by calling a new
helper like clearSearchResults()), reset the search results state (e.g., set
_searchResults or _searchList to an empty list or invoke clearSearchResults()),
clear any other savedStateHandle search keys (in addition to SEARCH_AUTHOR, e.g.
SEARCH_QUERY if present), and then set _isSosoPickVisible.value = true so the UI
fully returns to the initial state.
- Around line 55-63: fetchSosoPicks currently only handles success and leaves UI
state undefined on failure, causing an empty list section to render; update
fetchSosoPicks (inside viewModelScope.launch that calls
novelRepository.fetchSosoPicks) to handle failures from runCatching by setting
_sosoPicks to an empty list or an appropriate error/empty state and/or update a
loading/error LiveData so the UI can hide the section or show an error message
when novelRepository.fetchSosoPicks fails.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7e90cfae-a5d4-4801-897b-f8e87e0d138f

📥 Commits

Reviewing files that changed from the base of the PR and between 15b9cf3 and 610cd3e.

📒 Files selected for processing (5)
  • app/src/main/java/com/into/websoso/ui/main/explore/ExploreFragment.kt
  • app/src/main/java/com/into/websoso/ui/normalExplore/NormalExploreActivity.kt
  • app/src/main/java/com/into/websoso/ui/normalExplore/NormalExploreViewModel.kt
  • app/src/main/res/layout/activity_normal_explore.xml
  • app/src/main/res/layout/fragment_explore.xml
💤 Files with no reviewable changes (2)
  • app/src/main/res/layout/fragment_explore.xml
  • app/src/main/java/com/into/websoso/ui/main/explore/ExploreFragment.kt

Comment on lines +55 to +63
private fun fetchSosoPicks() {
viewModelScope.launch {
runCatching {
novelRepository.fetchSosoPicks()
}.onSuccess { result ->
_sosoPicks.value = result.novels
}
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

소소픽 조회 실패를 무시하면 빈 섹션 UI가 남습니다.

Line 57-61은 성공만 처리하고 실패 시 상태가 정의되지 않아, 타이틀/설명만 보이고 리스트가 비는 어색한 상태가 발생할 수 있습니다.

수정 예시
 private fun fetchSosoPicks() {
     viewModelScope.launch {
         runCatching {
             novelRepository.fetchSosoPicks()
         }.onSuccess { result ->
             _sosoPicks.value = result.novels
+        }.onFailure {
+            _sosoPicks.value = emptyList()
+            _isSosoPickVisible.value = false
         }
     }
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private fun fetchSosoPicks() {
viewModelScope.launch {
runCatching {
novelRepository.fetchSosoPicks()
}.onSuccess { result ->
_sosoPicks.value = result.novels
}
}
}
private fun fetchSosoPicks() {
viewModelScope.launch {
runCatching {
novelRepository.fetchSosoPicks()
}.onSuccess { result ->
_sosoPicks.value = result.novels
}.onFailure {
_sosoPicks.value = emptyList()
_isSosoPickVisible.value = false
}
}
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@app/src/main/java/com/into/websoso/ui/normalExplore/NormalExploreViewModel.kt`
around lines 55 - 63, fetchSosoPicks currently only handles success and leaves
UI state undefined on failure, causing an empty list section to render; update
fetchSosoPicks (inside viewModelScope.launch that calls
novelRepository.fetchSosoPicks) to handle failures from runCatching by setting
_sosoPicks to an empty list or an appropriate error/empty state and/or update a
loading/error LiveData so the UI can hide the section or show an error message
when novelRepository.fetchSosoPicks fails.

Comment on lines 113 to 117
fun updateSearchWordEmpty() {
_searchWord.value = ""
savedStateHandle[SEARCH_AUTHOR] = ""
_isSosoPickVisible.value = true
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

검색 취소 시 이전 결과가 남아 초기 화면 복원이 깨집니다.

Line 116에서 소소픽만 다시 보이게 하고 검색 결과 상태를 비우지 않아, 취소 후에도 이전 리스트가 그대로 남을 수 있습니다.

수정 예시
 fun updateSearchWordEmpty() {
     _searchWord.value = ""
     savedStateHandle[SEARCH_AUTHOR] = ""
     _isSosoPickVisible.value = true
+    _uiState.value = _uiState.value?.copy(
+        novelCount = 0,
+        novels = emptyList(),
+        isLoadable = true,
+        error = false,
+    )
+    _isNovelResultEmptyBoxVisibility.value = false
 }
 private fun updateView(uiState: NormalExploreUiState) {
     val header = Header(uiState.novelCount)
     val novels = uiState.novels.map { Novels(it) }

-    if (uiState.novels.isNotEmpty()) {
-        when (uiState.isLoadable) {
-            true -> normalExploreAdapter.submitList(listOf(header) + novels + Loading)
-            false -> normalExploreAdapter.submitList(listOf(header) + novels)
-        }
-    }
+    val items =
+        if (uiState.novels.isNotEmpty()) {
+            if (uiState.isLoadable) listOf(header) + novels + Loading else listOf(header) + novels
+        } else {
+            emptyList()
+        }
+    normalExploreAdapter.submitList(items)
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@app/src/main/java/com/into/websoso/ui/normalExplore/NormalExploreViewModel.kt`
around lines 113 - 117, updateSearchWordEmpty currently only clears the query
and toggles _isSosoPickVisible, but it doesn't clear the stored search results
so the previous list remains; inside updateSearchWordEmpty (and/or by calling a
new helper like clearSearchResults()), reset the search results state (e.g., set
_searchResults or _searchList to an empty list or invoke clearSearchResults()),
clear any other savedStateHandle search keys (in addition to SEARCH_AUTHOR, e.g.
SEARCH_QUERY if present), and then set _isSosoPickVisible.value = true so the UI
fully returns to the initial state.

Copy link
Copy Markdown
Contributor

@devfeijoa devfeijoa left a comment

Choose a reason for hiding this comment

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

LGTM 👍🏻 수고하셨습니당

@m6z1 m6z1 merged commit 297ad54 into develop Apr 30, 2026
3 checks passed
@m6z1 m6z1 deleted the feat/872 branch April 30, 2026 10:59
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.

feat: 일반 검색 개선

2 participants