I have a state
val selectedRationList: MutableStateFlow<ArrayList<Ration>?> = MutableStateFlow(null)`
I updated this like this
uiState.selectedRationList.update { data }
The problem here is that when the list becomes empty, it recomposes the UI only once and doesn't recompose whether you try to add new items to the list or remove them.
But when it became empty I did it like this
if (data.isEmpty()) {
state.selectedRationList.value = null
} else {
state.selectedRationList.value = data
}
It recomposes as many times I add new items or remove them. Why?