you can try using StateFlow something like this: Your ViewModel
private val _repDataPoints = MutableStateFlow<List<RepDataPoint>>(listOfemptyList())
val repDataPoints = _repDataPoints.asStateFlow()
Your Composable:
val list by viewModel.repDataPoints.collectAsState(initial = emptyListcollectAsStateWithLifecycle())
And finally to modify repDataPoints value you can do something like that:
fun addNewValue() {
viewModelScope.launch {
val list = _repDataPoints.value.toMutableList()
list.add(RepoDataPoits())
update { it + _repDataPoints.emitRepDataPoint(list)
}
}
I think the problem is your list that you have in you viewmodel cant notify to your composable and never recompose