Skip to content

[hotfix] user info #208

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

Merged
merged 7 commits into from
Apr 2, 2024
Merged

[hotfix] user info #208

merged 7 commits into from
Apr 2, 2024

Conversation

Jokwanhee
Copy link
Collaborator

버그

  • 로그아웃 & 회원탈퇴 SingleLiveEvent value NPE
    => SharedFlow 로 변경

  • LoginViewModel StateFlow -> SharedFlow

@Jokwanhee Jokwanhee added the bug Something isn't working label Mar 31, 2024
@Jokwanhee Jokwanhee requested a review from yunjaena March 31, 2024 09:24
@Jokwanhee Jokwanhee self-assigned this Mar 31, 2024
@Jokwanhee Jokwanhee requested a review from a team as a code owner March 31, 2024 09:24
Copy link
Contributor

@yunjaena yunjaena left a comment

Choose a reason for hiding this comment

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

수고했습니다. Comment 확인해주세요!

import kotlinx.coroutines.flow.asStateFlow
import javax.inject.Inject

@HiltViewModel
class LoginViewModel @Inject constructor(
private val userLoginUseCase: UserLoginUseCase,
) : BaseViewModel() {
private val _loginState = MutableStateFlow<LoginState>(LoginState.Init)
val loginState: StateFlow<LoginState> = _loginState.asStateFlow()
private val _loginState = MutableSharedFlow<LoginState>()
Copy link
Contributor

Choose a reason for hiding this comment

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

단일성 이벤트를 위해서 변경한건가요?
https://medium.com/androiddevelopers/viewmodel-one-off-event-antipatterns-16a1da869b95
참고해보시면 좋을것 같네요

@Jokwanhee
Copy link
Collaborator Author

EventFlow를 만들어서 문제점을 개선할 수 있었습니다.
SharedFlow를 그대로 사용하면서 EventFlow 래퍼 클래스를 사용하는 것이 제가 생각한 해결책이었습니다.

🗒️ 정리한 노션 : SharedFlow + EventFlow

📓 커밋 : 29c7b8f

@Jokwanhee
Copy link
Collaborator Author

@yunjaena
EventFlow를 사용하지 않고 State를 초기화하는 식으로 접근해서 해결했습니다.

📚 commit : bb84301

@yunjaena yunjaena merged commit 92cbc5a into production Apr 2, 2024
@nodobi nodobi deleted the hotfix/jkh/user_info branch April 20, 2024 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants