Conversation
검색 실행 전에는 표시되고, 검색 후에는 숨김 처리. 취소 버튼으로 검색어 지우면 다시 표시.
Walkthrough이 변경사항은 '소소 픽' 기능을 ExploreFragment에서 NormalExploreActivity로 이전합니다. ViewModel에 새로운 LiveData 속성을 추가하고, Activity에서 이를 관찰하여 RecyclerView를 구성하며, 레이아웃을 그에 따라 조정합니다. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (5)
app/src/main/java/com/into/websoso/ui/main/explore/ExploreFragment.ktapp/src/main/java/com/into/websoso/ui/normalExplore/NormalExploreActivity.ktapp/src/main/java/com/into/websoso/ui/normalExplore/NormalExploreViewModel.ktapp/src/main/res/layout/activity_normal_explore.xmlapp/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
| private fun fetchSosoPicks() { | ||
| viewModelScope.launch { | ||
| runCatching { | ||
| novelRepository.fetchSosoPicks() | ||
| }.onSuccess { result -> | ||
| _sosoPicks.value = result.novels | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
소소픽 조회 실패를 무시하면 빈 섹션 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.
| 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.
| fun updateSearchWordEmpty() { | ||
| _searchWord.value = "" | ||
| savedStateHandle[SEARCH_AUTHOR] = "" | ||
| _isSosoPickVisible.value = true | ||
| } |
There was a problem hiding this comment.
검색 취소 시 이전 결과가 남아 초기 화면 복원이 깨집니다.
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.
📌𝘐𝘴𝘴𝘶𝘦𝘴
📎𝘞𝘰𝘳𝘬 𝘋𝘦𝘴𝘤𝘳𝘪𝘱𝘵𝘪𝘰𝘯
📷𝘚𝘤𝘳𝘦𝘦𝘯𝘴𝘩𝘰𝘵
💬𝘛𝘰 𝘙𝘦𝘷𝘪𝘦𝘸𝘦𝘳𝘴
Summary by CodeRabbit
변경 사항