diff --git a/Persistence/Sources/Persistence/PersistentContainer.swift b/Persistence/Sources/Persistence/PersistentContainer.swift index 615fe1a..a0094a8 100644 --- a/Persistence/Sources/Persistence/PersistentContainer.swift +++ b/Persistence/Sources/Persistence/PersistentContainer.swift @@ -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