Describe the bug
Inside Fragment, I defined a sharedViewModel and called ViewModel's method to dispatch data via ViewModel's LiveData.
Inside @Composable, I called getViewModel() and then did viewModel.liveData.observeAsState() to retrieve the data from ViewModel, however, the data cannot be retrieved.
When I switched sharedViewModel() to viewModel(), it worked as expected. So, I suppose that some issues might lie in sharedViewModel.
To Reproduce
Steps to reproduce the behavior:
Inside Fragment, define ViewModel with by sharedViewModel().
Call ViewModel's method and dispatch data using LiveData.
Inside @Composable, get ViewModel with getViewModel().
Try to get data from LiveData with viewModel.liveData.observeAsState().
Expected behavior
Data is retrieved from ViewModel.
Koin project used and used version (please complete the following information):
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 Inside Fragment, I defined a
sharedViewModel
and called ViewModel's method to dispatch data via ViewModel's LiveData. Inside@Composable
, I calledgetViewModel()
and then didviewModel.liveData.observeAsState()
to retrieve the data from ViewModel, however, the data cannot be retrieved.sharedViewModel()
toviewModel()
, it worked as expected. So, I suppose that some issues might lie in sharedViewModel.To Reproduce Steps to reproduce the behavior:
by sharedViewModel()
.@Composable
, get ViewModel withgetViewModel()
.viewModel.liveData.observeAsState()
.Expected behavior Data is retrieved from ViewModel.
Koin project used and used version (please complete the following information):