Describe the bug
I have a view model containing livedata is shared between an Activity and fragment. I update the livedata in the activity and observe it in fragment via activityViewModel. The expected beaviour is that the viewmodel observer should fire when viewmodel is updated in the activity, which is not happening.
This issue is only visible in koin version 3.5.3. Its not happening in 3.5.0
To Reproduce
Steps to reproduce the behavior:
Create a viewmodel with mutable live data
Consume the viewmodel in activity via by viewModel()
Write the live data update code in activity [Add debug point]
Consume the same view model is fragment via by activityViewModel()
Write the live data observer [Add debug point]
Run the app is debug mode
Observe that the first debug point in activity is reached but second does not.
Koin module and version:koin-core:3.5.3
Snippet or Sample project to help reproduce
class ActivitySharedViewModel : ViewModel() {
private val _isEnabledEvent = MutableLiveData<Event<Boolean>>()
val isEnabledEvent: LiveData<Event<Boolean>> = _isEnabledEvent
fun setIsEnabled(isEnabled: Boolean){
_isEnabledEvent.value = Event(isEnabled)
}
}
// Fragment Code
activitySharedViewModel.isEnabledEvent.observeEvent(viewLifecycleOwner) {
isEnabled = it
}
// Activity Code
activitySharedViewModel.setIsEnabled(true)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Describe the bug I have a view model containing livedata is shared between an Activity and fragment. I update the livedata in the activity and observe it in fragment via activityViewModel. The expected beaviour is that the viewmodel observer should fire when viewmodel is updated in the activity, which is not happening.
This issue is only visible in koin version 3.5.3. Its not happening in 3.5.0
To Reproduce Steps to reproduce the behavior:
by viewModel()
by activityViewModel()
Koin module and version:
koin-core:3.5.3
Snippet or Sample project to help reproduce