diff --git a/app/src/main/java/at/techbee/jtx/ui/detail/DetailViewModel.kt b/app/src/main/java/at/techbee/jtx/ui/detail/DetailViewModel.kt index 9dea059b2..9fc6e3575 100644 --- a/app/src/main/java/at/techbee/jtx/ui/detail/DetailViewModel.kt +++ b/app/src/main/java/at/techbee/jtx/ui/detail/DetailViewModel.kt @@ -128,20 +128,21 @@ class DetailViewModel(application: Application) : AndroidViewModel(application) viewModelScope.launch { withContext(Dispatchers.Main) { changeState.value = DetailChangeState.LOADING } + mutableCategories.clear() + mutableResources.clear() + mutableAttendees.clear() + mutableComments.clear() + mutableAttachments.clear() + mutableAlarms.clear() + withContext(Dispatchers.IO) { originalEntry = databaseDao.getSync(icalObjectId) mutableICalObject = originalEntry?.property - mutableCategories.clear() mutableCategories.addAll(databaseDao.getCategoriesSync(icalObjectId)) - mutableResources.clear() mutableResources.addAll(databaseDao.getResourcesSync(icalObjectId)) - mutableAttendees.clear() mutableAttendees.addAll(databaseDao.getAttendeesSync(icalObjectId)) - mutableComments.clear() mutableComments.addAll(databaseDao.getCommentsSync(icalObjectId)) - mutableAttachments.clear() mutableAttachments.addAll(databaseDao.getAttachmentsSync(icalObjectId)) - mutableAlarms.clear() mutableAlarms.addAll(databaseDao.getAlarmsSync(icalObjectId)) }