Mike Speed
02/18/2022, 11:16 AMLazyColumn
. I am updating the menuList State
in the ViewModel, the view recomposes but the debugger 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() {
items(menuList.value.size) { i->
MenuItem(menuList.value[i])
}
}
MyViewModel:
private var menu: MenuUiState? = null
val menuData: SingleLiveEvent<MenuUiState> by lazy { SingleLiveEvent() }
// ...
menu?.sections?.forEach {
//update menu properties here
}
menuData.value = menu?.copy()
Lokik Soni
02/18/2022, 11:20 AMMike Speed
02/18/2022, 11:21 AMitems(){}
line to check the sizeColton Idle
02/18/2022, 5:05 PMMike Speed
02/18/2022, 5:06 PMLazyColumn() {
is printedAdrijan Rogan
02/19/2022, 1:31 PMitems(menuList.value)
or itemsIndexed(menuList.value)
if you really need indices.Adrijan Rogan
02/19/2022, 1:33 PMitems
block will not be executed.