when I use the combine operator with the stateIn operator to combine two flows to one state flow in the view model, using clean architecture and MVI pattern I only get the initial value of the stateIn operator.
my code is this:
@HiltViewModel
class UserViewModel @Inject constructor(private val userUseCases: UserUseCases) :
ViewModel() {
val userState = userUseCases.getUser()
.combine(userUseCases.getPreferencesData()) { user, prefs ->
UserState(user, prefs)
}.stateIn(
viewModelScope,
SharingStarted.Eagerly,
UserState(initialUser, initialPrefs)
)
}
in both of the view model test class and the main activity the value of userState is the initial value I've also debugged the app; combine seems to work fine (UserState data class gets populated) I appreciate any suggestions and solutions