Set automaticallyMergesChangesFromParent on NSManagedObjectContexts

This commit is contained in:
Shadowfacts 2022-09-12 22:38:13 -04:00
parent 6881441671
commit 402e12a074
1 changed files with 3 additions and 0 deletions

View File

@ -22,6 +22,7 @@ public class PersistentContainer: NSPersistentContainer, @unchecked Sendable {
// the background context needs to be parented directly to the PSC
// if it's parented to the viewContext, it blocks the viewContext (and potentially the main thread) when it needs to look things up
context.persistentStoreCoordinator = self.persistentStoreCoordinator
context.automaticallyMergesChangesFromParent = true
return context
}()
@ -62,6 +63,8 @@ public class PersistentContainer: NSPersistentContainer, @unchecked Sendable {
fatalError("Unable to load persistent store: \(error)")
}
}
viewContext.automaticallyMergesChangesFromParent = true
}
@MainActor