When deleting highlights finish core data sync before triggering API sync

This commit is contained in:
Jackson Harper
2023-04-05 19:54:03 +08:00
parent 89119add8a
commit 13faffffcc
2 changed files with 3 additions and 4 deletions

View File

@ -6,7 +6,7 @@ import SwiftGraphQL
public extension DataService {
func deleteHighlight(highlightID: String) {
// Update CoreData so view updates immediately
viewContext.perform {
viewContext.performAndWait {
guard let highlight = Highlight.lookup(byID: highlightID, inContext: self.viewContext) else { return }
highlight.serverSyncStatus = Int64(ServerSyncStatus.needsDeletion.rawValue)
@ -17,9 +17,8 @@ public extension DataService {
self.viewContext.rollback()
logger.debug("Failed to mark Highlight for deletion: \(error.localizedDescription)")
}
self.syncHighlightDeletion(highlightID: highlightID)
}
syncHighlightDeletion(highlightID: highlightID)
}
func syncHighlightDeletion(highlightID: String) {

File diff suppressed because one or more lines are too long