I have use clone to create new object and update like that:
fun sync(item: LibraryItem) {
viewModelScope.launch {
val debugValue = item.userMediaProgress.toUpload
val updated = apiHandler.updateProgress(item.userMediaProgress)
if (updated) {
val newItem = item.copy()
newItem.userMediaProgress.toUpload = !debugValue
_item.postValue(newItem)
}
}
}
But I dont get changes in UI. When I create new complete object it works. Why?