Set automaticallyMergesChangesFromParent on NSManagedObjectContexts
This commit is contained in:
parent
6881441671
commit
402e12a074
|
@ -22,6 +22,7 @@ public class PersistentContainer: NSPersistentContainer, @unchecked Sendable {
|
||||||
// the background context needs to be parented directly to the PSC
|
// 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
|
// 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.persistentStoreCoordinator = self.persistentStoreCoordinator
|
||||||
|
context.automaticallyMergesChangesFromParent = true
|
||||||
return context
|
return context
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -62,6 +63,8 @@ public class PersistentContainer: NSPersistentContainer, @unchecked Sendable {
|
||||||
fatalError("Unable to load persistent store: \(error)")
|
fatalError("Unable to load persistent store: \(error)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
viewContext.automaticallyMergesChangesFromParent = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
|
|
Loading…
Reference in New Issue