Conversation
WalkthroughChallengeMissionProgressViewModel의 postChallengeAdvanceDay 실패 핸들러가 수정되어, 이제 HttpException 중 HTTP 404 응답을 감지하면 NavigateToChallengeStart 사이드 이펙트를 발행합니다. 다른 성공 및 로딩 경로는 변경되지 않았습니다. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
🚥 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
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
`@app/src/main/java/com/cherrish/android/presentation/challenge/missionprogress/ChallengeMissionProgressViewModel.kt`:
- Around line 122-126: The MutableSharedFlow used for side effects (_sideEffect
/ MutableSharedFlow<ChallengeMissionProgressSideEffect>) is created with the
default 0 buffer which risks dropping events during brief absence of collectors;
update its initialization to add extraBufferCapacity (e.g., extraBufferCapacity
= 1 or 2) while keeping emit() calls (do not switch to tryEmit()), so emits like
_sideEffect.emit(ChallengeMissionProgressSideEffect.NavigateToChallengeStart)
will be buffered safely even across short lifecycle/Compose recompositions.
| .onLogFailure { e -> | ||
| if (e is retrofit2.HttpException && e.code() == 404) { | ||
| _sideEffect.emit(ChallengeMissionProgressSideEffect.NavigateToChallengeStart) | ||
| } | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
cat app/src/main/java/com/cherrish/android/presentation/challenge/missionprogress/ChallengeMissionProgressViewModel.kt | head -150Repository: TEAM-Cherrish/Cherrish-Android
Length of output: 5947
🏁 Script executed:
cd app/src/main/java/com/cherrish/android/presentation/challenge/missionprogress && find . -type f -name "*.kt" | grep -i screen | head -5Repository: TEAM-Cherrish/Cherrish-Android
Length of output: 109
🏁 Script executed:
find app/src/main/java/com/cherrish/android/presentation/challenge/missionprogress -type f -name "*Screen*.kt" -o -name "*UI*.kt" -o -name "*Composable*.kt"Repository: TEAM-Cherrish/Cherrish-Android
Length of output: 185
🏁 Script executed:
rg "ChallengeMissionProgressSideEffect|ChallengeMissionProgressViewModel" app/src/main/java/com/cherrish/android/presentation/challenge/missionprogress --type kt -lRepository: TEAM-Cherrish/Cherrish-Android
Length of output: 100
🏁 Script executed:
cat app/src/main/java/com/cherrish/android/presentation/challenge/missionprogress/ChallengeMissionProgressScreen.ktRepository: TEAM-Cherrish/Cherrish-Android
Length of output: 7676
🏁 Script executed:
rg "fun.*collectLatestSideEffect" --type kt -A 5Repository: TEAM-Cherrish/Cherrish-Android
Length of output: 100
🏁 Script executed:
rg "fun.*collectLatestSideEffect" -A 5Repository: TEAM-Cherrish/Cherrish-Android
Length of output: 691
🏁 Script executed:
cat app/src/main/java/com/cherrish/android/core/common/extension/FlowExt.ktRepository: TEAM-Cherrish/Cherrish-Android
Length of output: 1032
SideEffect 이벤트 손실 방지를 위해 버퍼 용량 추가 권장
현재 MutableSharedFlow 기본 버퍼가 0으로 설정되어 있습니다. UI 레이어가 collectLatestSideEffect로 적극적으로 수집하는 구조이므로 일반적인 상황에서 emit()이 블로킹되지는 않으나, Compose 재구성이나 라이프사이클 전환 중 수집자가 일시적으로 없을 수 있습니다. 안정성을 위해 extraBufferCapacity를 추가하는 것이 좋습니다.
주의: tryEmit()은 버퍼가 가득 차면 false를 반환하고 이벤트를 드롭하므로 탐색 이벤트 손실로 이어질 수 있습니다. emit() 유지하고 버퍼만 확대하는 것을 권장합니다.
🛠️ 개선 제안
- private val _sideEffect = MutableSharedFlow<ChallengeMissionProgressSideEffect>()
+ private val _sideEffect = MutableSharedFlow<ChallengeMissionProgressSideEffect>(
+ extraBufferCapacity = 1
+ )🤖 Prompt for AI Agents
In
`@app/src/main/java/com/cherrish/android/presentation/challenge/missionprogress/ChallengeMissionProgressViewModel.kt`
around lines 122 - 126, The MutableSharedFlow used for side effects (_sideEffect
/ MutableSharedFlow<ChallengeMissionProgressSideEffect>) is created with the
default 0 buffer which risks dropping events during brief absence of collectors;
update its initialization to add extraBufferCapacity (e.g., extraBufferCapacity
= 1 or 2) while keeping emit() calls (do not switch to tryEmit()), so emits like
_sideEffect.emit(ChallengeMissionProgressSideEffect.NavigateToChallengeStart)
will be buffered safely even across short lifecycle/Compose recompositions.
Related issue 🛠
Work Description ✏️
Screenshot 📸
Uncompleted Tasks 😅
To Reviewers 📢
급하게 해결한 거라 qa 끝나고 로직 수정해야할 것 같아요 cc. @hyeminililo
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.