Open weijia1991 opened 1 year ago
I'm experiencing the same issue, is it because it's not recommended for use in Activity and therefore doesn't provide a solution?
invalidate
function has comment: "Override this to handle any state changes from MavericksViewModels created through Mavericks Fragment delegates." so this method is just used in Fragment class.
If you want to observe state change in Activity, you can use :
viewModel.onEach(State::property) {
// refresh ui
}
In activity by viewModel() is not working properly, the invalidate() method doesn't callback when the viewLifecycleOwner is started, viewModel() is missing the postInvalidate() logic like activityViewModel(), please tell me how should I do it in activity. Can I modify the viewModel() code like this: