Conversation
워크스루검색 결과 업데이트 시 초기 조건을 개선했습니다. 검색 버튼 클릭이 아닌 경우, 검색어가 비어있거나 공백이거나 콘텐츠가 로드 불가능할 때 함수 실행을 차단합니다. 변경사항
예상 코드 리뷰 소요시간🎯 1 (단순) | ⏱️ ~5 분 제안된 리뷰어
시
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/src/main/java/com/into/websoso/ui/normalExplore/NormalExploreViewModel.kt (1)
33-42: 수정 로직은 적절하나,query변수 사용의 일관성을 고려해 주세요.스크롤 시 빈 검색어에 대한 API 호출을 방지하는 수정은 올바릅니다. 다만 Line 34에서
trim()된query변수를 생성했지만, Line 42의 실제 API 호출에서는 원본searchWord.value를 그대로 사용하고 있습니다.이로 인해 검색 버튼 클릭 시 공백만 있는 검색어(예:
" ")가 그대로 API에 전달될 수 있습니다. 일관성을 위해 API 호출에도query변수를 사용하는 것을 권장합니다.♻️ 제안된 수정 사항
fun updateSearchResult(isSearchButtonClick: Boolean) { val query = _searchWord.value?.trim() ?: "" // 검색어가 없고 스크롤을 하였을 경우 추가 if ((query.isEmpty() || _uiState.value?.isLoadable == false) && !isSearchButtonClick) { return } viewModelScope.launch { _uiState.value = _uiState.value?.copy(loading = isSearchButtonClick) runCatching { - getNormalExploreResultUseCase(searchWord.value ?: "", isSearchButtonClick) + getNormalExploreResultUseCase(query, isSearchButtonClick) }.onSuccess { results ->🤖 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 33 - 42, The method updateSearchResult creates a trimmed local variable query but then calls getNormalExploreResultUseCase with searchWord.value, which can pass untrimmed or whitespace-only input; change the call inside viewModelScope.launch to use the trimmed query variable (query) instead of searchWord.value so the same sanitized value is used for the API call and for the empty-check logic in updateSearchResult.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@app/src/main/java/com/into/websoso/ui/normalExplore/NormalExploreViewModel.kt`:
- Around line 33-42: The method updateSearchResult creates a trimmed local
variable query but then calls getNormalExploreResultUseCase with
searchWord.value, which can pass untrimmed or whitespace-only input; change the
call inside viewModelScope.launch to use the trimmed query variable (query)
instead of searchWord.value so the same sanitized value is used for the API call
and for the empty-check logic in updateSearchResult.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 33319be9-ba85-43c3-9b91-2fa4116067b4
📒 Files selected for processing (1)
app/src/main/java/com/into/websoso/ui/normalExplore/NormalExploreViewModel.kt
app/src/main/java/com/into/websoso/ui/normalExplore/NormalExploreViewModel.kt
Outdated
Show resolved
Hide resolved
devfeijoa
left a comment
There was a problem hiding this comment.
첫 PR이네요!! 수고하셨습니다 👍🏻
CI 실패했다고 뜨는데 그것만 확인 부탁드려요!
There was a problem hiding this comment.
🧹 Nitpick comments (1)
feature/feed/src/main/java/com/into/websoso/feature/feed/FeedScreen.kt (1)
234-235: 디버그 로그가 남아있습니다.
Log.d("123123", tab.toString())는 디버깅 목적의 코드로 보입니다. 이 PR의 변경 사항은 아니지만, 프로덕션 코드에서 제거하는 것이 좋습니다.🧹 디버그 로그 제거 제안
onClick = { - Log.d("123123", tab.toString()) onTabClick(tab) },🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@feature/feed/src/main/java/com/into/websoso/feature/feed/FeedScreen.kt` around lines 234 - 235, Remove the remaining debug log call Log.d("123123", tab.toString()) in FeedScreen (near the onTabClick(tab) invocation); either delete the line or replace it with an appropriate production-level log/message (e.g., use a meaningful tag and log level or telemetry) so only intentional, contextual logging remains in the FeedScreen UI tab handling code.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@feature/feed/src/main/java/com/into/websoso/feature/feed/FeedScreen.kt`:
- Around line 234-235: Remove the remaining debug log call Log.d("123123",
tab.toString()) in FeedScreen (near the onTabClick(tab) invocation); either
delete the line or replace it with an appropriate production-level log/message
(e.g., use a meaningful tag and log level or telemetry) so only intentional,
contextual logging remains in the FeedScreen UI tab handling code.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 673285e1-176b-4612-9ce2-2be93e3d9e30
📒 Files selected for processing (1)
feature/feed/src/main/java/com/into/websoso/feature/feed/FeedScreen.kt
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 51-52: The current guard in NormalExploreViewModel that checks
_searchWord and _uiState to decide whether to return prevents pagination when
the input box is cleared; introduce and use a separate state (e.g.,
lastQueriedSearchWord: String?) to remember the search term used for the most
recent successful fetch, update lastQueriedSearchWord when a real API call is
made (inside the method that performs the fetch, referenced by
updateSearchResult / the ViewModel's fetch/search method), and change the
early-return condition to compare against lastQueriedSearchWord (or use it for
paging decisions) instead of _searchWord so clearing the input field does not
block subsequent page loads. Ensure clearing _searchWord does not reset
lastQueriedSearchWord and that pagination increments still reference
lastQueriedSearchWord for API calls.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6e3e30ff-f8d3-44f2-ba8d-e65d194ee2a8
📒 Files selected for processing (1)
app/src/main/java/com/into/websoso/ui/normalExplore/NormalExploreViewModel.kt
| if ((_searchWord.value.isNullOrBlank() || _uiState.value?.isLoadable == false) && !isSearchButtonClick) { | ||
| return |
There was a problem hiding this comment.
현재 입력값으로 페이징을 막으면 기존 검색 결과가 끊깁니다.
NormalExploreActivity.kt Line 63-68에서는 스크롤마다 updateSearchResult(false)를 호출하고, 이 ViewModel의 Line 90-93에서는 입력값만 비우고 결과 목록은 유지합니다. 그래서 한 번 검색한 뒤 입력창만 지우면 리스트는 남아 있는데 여기서 바로 return 되어 다음 페이지 로드가 영구히 막힙니다. 페이징 조건과 API 호출에는 “현재 입력값”이 아니라 “마지막으로 실제 조회에 사용한 검색어”를 별도 상태로 써야 합니다. 그렇지 않으면 빈 입력 방어는 되더라도 스크롤 페이징이 회귀합니다.
🤖 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 51 - 52, The current guard in NormalExploreViewModel that checks
_searchWord and _uiState to decide whether to return prevents pagination when
the input box is cleared; introduce and use a separate state (e.g.,
lastQueriedSearchWord: String?) to remember the search term used for the most
recent successful fetch, update lastQueriedSearchWord when a real API call is
made (inside the method that performs the fetch, referenced by
updateSearchResult / the ViewModel's fetch/search method), and change the
early-return condition to compare against lastQueriedSearchWord (or use it for
paging decisions) instead of _searchWord so clearing the input field does not
block subsequent page loads. Ensure clearing _searchWord does not reset
lastQueriedSearchWord and that pagination increments still reference
lastQueriedSearchWord for API calls.
|
CI도 해결됐네요! 수고하셨습니다 👍 |
📌𝘐𝘴𝘴𝘶𝘦𝘴
📎𝘞𝘰𝘳𝘬 𝘋𝘦𝘴𝘤𝘳𝘪𝘱𝘵𝘪𝘰𝘯
📷𝘚𝘤𝘳𝘦𝘦𝘯𝘴𝘩𝘰𝘵
KakaoTalk_Video_2026-03-04-22-45-43.mp4
💬𝘛𝘰 𝘙𝘦𝘷𝘪𝘦𝘸𝘦𝘳𝘴
확인해보니 클릭 시가 아닌 스크롤 시 api 요청을 보내어 생기는 오류인 걸로 확인했습니다. 검색어가 없을 경우 곧바로 return 하게 변경했습니다.
Summary by CodeRabbit
릴리스 노트