diff --git a/Frameworks/Account/CloudKit/CloudKitAccountDelegate.swift b/Frameworks/Account/CloudKit/CloudKitAccountDelegate.swift index 77e651e61..6f235ffa9 100644 --- a/Frameworks/Account/CloudKit/CloudKitAccountDelegate.swift +++ b/Frameworks/Account/CloudKit/CloudKitAccountDelegate.swift @@ -627,6 +627,8 @@ private extension CloudKitAccountDelegate { group.notify(queue: DispatchQueue.main) { + newAndUpdatedArticles = newAndUpdatedArticles.subtracting(deletedArticles) + self.articlesZone.deleteArticles(deletedArticles) { _ in self.refreshProgress.completeTask() self.articlesZone.saveNewArticles(newAndUpdatedArticles) { _ in @@ -677,6 +679,8 @@ private extension CloudKitAccountDelegate { newAndUpdatedArticles.formUnion(articleChanges.updatedArticles ?? Set
()) let deletedArticles = articleChanges.deletedArticles ?? Set
() + newAndUpdatedArticles = newAndUpdatedArticles.subtracting(deletedArticles) + self.articlesZone.deleteArticles(deletedArticles) { _ in self.refreshProgress.completeTask() self.articlesZone.saveNewArticles(newAndUpdatedArticles) { _ in @@ -756,6 +760,7 @@ private extension CloudKitAccountDelegate { var newAndUpdatedArticles = articleChanges.newArticles ?? Set
() newAndUpdatedArticles.formUnion(articleChanges.updatedArticles ?? Set
()) let deletedArticles = articleChanges.deletedArticles ?? Set
() + newAndUpdatedArticles = newAndUpdatedArticles.subtracting(deletedArticles) self.articlesZone.deleteArticles(deletedArticles) { _ in self.refreshProgress.completeTask() diff --git a/Frameworks/Account/CloudKit/CloudKitAccountZoneDelegate.swift b/Frameworks/Account/CloudKit/CloudKitAccountZoneDelegate.swift index e6f3f6374..8fe7702b3 100644 --- a/Frameworks/Account/CloudKit/CloudKitAccountZoneDelegate.swift +++ b/Frameworks/Account/CloudKit/CloudKitAccountZoneDelegate.swift @@ -217,6 +217,7 @@ private extension CloudKitAcountZoneDelegate { var newAndUpdatedArticles = articleChanges.newArticles ?? Set
() newAndUpdatedArticles.formUnion(articleChanges.updatedArticles ?? Set
()) let deletedArticles = articleChanges.deletedArticles ?? Set
() + newAndUpdatedArticles = newAndUpdatedArticles.subtracting(deletedArticles) self.articlesZone?.deleteArticles(deletedArticles) { _ in self.refreshProgress?.completeTask() @@ -259,6 +260,7 @@ private extension CloudKitAcountZoneDelegate { var newAndUpdatedArticles = articleChanges.newArticles ?? Set
() newAndUpdatedArticles.formUnion(articleChanges.updatedArticles ?? Set
()) let deletedArticles = articleChanges.deletedArticles ?? Set
() + newAndUpdatedArticles = newAndUpdatedArticles.subtracting(deletedArticles) self.articlesZone?.deleteArticles(deletedArticles) { _ in self.refreshProgress?.completeTask()