Colton Idle
02/27/2022, 11:24 PMmutableStateListOf<T>
but when I call clear() and then addAll() to it, it seems like compose tries to be "smart" and apply only the changes between the two lists. Is there a way to "opt out" of that behavior?
So Im looking to go from this:
state.list.clear()
state.list.addAll(networkResult.newItems)
to something like this (completely made up api)
state.list.clear().commitTransactionAndWait()
state.list.addAll(networkResult.newItems).commitTransactionAndWait()
state.list.clear()
viewModelScope.launch {
delay(500)
state.list.addAll(networkResult.newItems)
}
jw
02/27/2022, 11:44 PMColton Idle
02/28/2022, 1:07 AMstate.list = mutableStateListOf()
state.list.addAll(networkResult.newItems)
state.list = mutableStateListOf()
viewModelScope.launch {
delay(500)
state.list.addAll(networkResult.newItems)
}
then I'm back in business.eygraber
02/28/2022, 2:13 AMColton Idle
02/28/2022, 2:14 AMeygraber
02/28/2022, 2:15 AMviewModelScope.launch(Dispatchers.Default) {
state.list.clear()
state.list.addAll(networkResult.newItems)
}
Adam Powell
02/28/2022, 2:43 AMColton Idle
02/28/2022, 2:52 AMAdam Powell
02/28/2022, 3:16 AMColton Idle
02/28/2022, 3:52 AMAdam Powell
02/28/2022, 4:03 AMOutlinedTextField
. Probably worth filing a bugColton Idle
02/28/2022, 4:04 AM