-
Notifications
You must be signed in to change notification settings - Fork 0
[FIX/#86] 감정 구슬 기반 추천 루틴 추가 반영 문제 수정 #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Walkthrough추천 루틴 추가 시점에 이벤트 플로우를 통해 홈 화면이 즉시 갱신되도록, 도메인 모델과 저장소, 유스케이스, 그리고 HomeViewModel에 관련 이벤트 스트림과 관찰 로직이 추가되었습니다. 새로운 이벤트 타입과 플로우가 도입되어 추천 루틴 추가가 홈에 실시간 반영됩니다. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ViewModel
participant UseCase
participant Repository
participant DataSource
User->>ViewModel: 추천 루틴 추가 요청
ViewModel->>Repository: registerRecommendRoutineList()
Repository->>DataSource: registerRecommendRoutineList()
DataSource-->>Repository: Result.Success
Repository->>Repository: _onBoardingRecommendRoutineEventFlow.emit(AddRoutines)
Repository-->>ViewModel: (이벤트 플로우 노출)
ViewModel->>UseCase: getOnBoardingRecommendRoutineEventFlow()
UseCase->>Repository: getOnBoardingRecommendRoutineEventFlow()
Repository-->>UseCase: Flow<OnBoardingRecommendRoutineEvent>
UseCase-->>ViewModel: Flow<OnBoardingRecommendRoutineEvent>
ViewModel->>ViewModel: 이벤트 수신 시 fetchWeeklyRoutines()
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changes(해당 변경사항 중 범위 외 변경사항 없음) Poem
Note 🔌 MCP (Model Context Protocol) integration is now available in Early Access!Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
🧹 Nitpick comments (4)
domain/src/main/java/com/threegap/bitnagil/domain/onboarding/repository/OnBoardingRepository.kt (1)
14-15
: 이벤트 Flow 반환에는 suspend가 불필요합니다.Flow 객체 획득은 비차단/즉시 연산이라 suspend가 오히려 호출 측 제약만 추가합니다. 기존 패턴(다른 이벤트 UseCase/Repo)과의 일관성을 위해 suspend 제거를 권장합니다.
적용 diff:
- suspend fun getOnBoardingRecommendRoutineEventFlow(): Flow<OnBoardingRecommendRoutineEvent> + fun getOnBoardingRecommendRoutineEventFlow(): Flow<OnBoardingRecommendRoutineEvent>domain/src/main/java/com/threegap/bitnagil/domain/onboarding/model/OnBoardingRecommendRoutineEvent.kt (1)
3-5
: 이벤트 모델링 적절합니다.sealed interface + AddRoutines 형태로 확장성 좋습니다. 향후 의미 명확화를 위해 KDoc 추가 정도만 고려해 주세요.
domain/src/main/java/com/threegap/bitnagil/domain/onboarding/usecase/GetOnBoardingRecommendRoutineEventFlowUseCase.kt (1)
11-14
: UseCase의 invoke에 suspend 불필요 — 한 줄로 단순화 가능Flow를 단순 위임 반환하므로 suspend 제거 시 호출/가독성 개선됩니다.
적용 diff:
- suspend operator fun invoke(): Flow<OnBoardingRecommendRoutineEvent> { - return repository.getOnBoardingRecommendRoutineEventFlow() - } + operator fun invoke(): Flow<OnBoardingRecommendRoutineEvent> = + repository.getOnBoardingRecommendRoutineEventFlow()presentation/src/main/java/com/threegap/bitnagil/presentation/home/HomeViewModel.kt (1)
257-263
: 이벤트 수집부 예외 처리와 타입 분기 추가 제안
- collect에서 예외가 던져지면 코루틴이 취소되어 이후 이벤트를 놓칩니다. catch 연산자 추가를 권장합니다.
- sealed 이벤트 확장을 대비해 타입 분기로 필요한 이벤트에만 갱신을 트리거하세요.
적용 diff:
- viewModelScope.launch { - getOnBoardingRecommendRoutineEventFlowUseCase().collect { - fetchWeeklyRoutines(stateFlow.value.currentWeeks) - } - } + viewModelScope.launch { + getOnBoardingRecommendRoutineEventFlowUseCase() + .catch { e -> Log.e("HomeViewModel", "추천 루틴 이벤트 스트림 오류: ${e.message}", e) } + .collect { event -> + when (event) { + is com.threegap.bitnagil.domain.onboarding.model.OnBoardingRecommendRoutineEvent.AddRoutines -> { + fetchWeeklyRoutines(stateFlow.value.currentWeeks) + } + } + } + }추가 필요 import:
import kotlinx.coroutines.flow.catch // (선호 시) import com.threegap.bitnagil.domain.onboarding.model.OnBoardingRecommendRoutineEvent
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
data/src/main/java/com/threegap/bitnagil/data/onboarding/repositoryImpl/OnBoardingRepositoryImpl.kt
(2 hunks)domain/src/main/java/com/threegap/bitnagil/domain/onboarding/model/OnBoardingRecommendRoutineEvent.kt
(1 hunks)domain/src/main/java/com/threegap/bitnagil/domain/onboarding/repository/OnBoardingRepository.kt
(1 hunks)domain/src/main/java/com/threegap/bitnagil/domain/onboarding/usecase/GetOnBoardingRecommendRoutineEventFlowUseCase.kt
(1 hunks)presentation/src/main/java/com/threegap/bitnagil/presentation/home/HomeViewModel.kt
(4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (1)
presentation/src/main/java/com/threegap/bitnagil/presentation/home/HomeViewModel.kt (1)
8-8
: 주입 및 구독 지점 추가는 의도에 부합Home에서 온보딩 추천 루틴 이벤트를 관찰해 즉시 갱신하는 흐름이 적절합니다. 아래 수집부에 예외 처리만 보완하면 안정성이 올라갑니다(다음 코멘트 참고).
Also applies to: 51-51, 63-63
...c/main/java/com/threegap/bitnagil/data/onboarding/repositoryImpl/OnBoardingRepositoryImpl.kt
Show resolved
Hide resolved
...c/main/java/com/threegap/bitnagil/data/onboarding/repositoryImpl/OnBoardingRepositoryImpl.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다! 깔쌈하네용!
presentation/src/main/java/com/threegap/bitnagil/presentation/home/HomeViewModel.kt
Show resolved
Hide resolved
…t이 suspend되지 않도록 수정
[ PR Content ]
감정 구슬을 선택하면 나오는 추천 루틴을 등록하였을 때 해당 루틴이 홈 화면에 바로 반영되지 않는 문제를 수정합니다.
Related issue
Screenshot 📸
Screen_recording_20250809_185924.webm
Work Description
To Reviewers 📢
Summary by CodeRabbit