I have a very strange problem with my LazyColumn. I am updating the menuList State in the ViewModel, the view recomposes but the list doesn't get redrawn.
When I use the debugger, it gets to LazyColumn and then stops, which means the children aren’t redrawn with the new data. Any ideas why? Thanks!
MyView:
val menuList = viewModel.menuData.observeAsState()
LazyColumn() { // <- Debugger stops here
items(menuList.value.sections.size) { i->
MenuItem(menuList.value[i])
}
}
MyViewModel:
private var menu: MenuUiState? = null
val menuData: MutableLiveData<MenuUiState> by lazy {
MutableLiveData<MenuUiState>()
}
// ...
menu?.sections?.forEach {
//update menu properties here
}
menuData.value = menu?.copy()