diff --git a/Memola/Canvas/Elements/Geometries/Stroke/Strokes/PenStroke.swift b/Memola/Canvas/Elements/Geometries/Stroke/Strokes/PenStroke.swift index eed64e8..f633904 100644 --- a/Memola/Canvas/Elements/Geometries/Stroke/Strokes/PenStroke.swift +++ b/Memola/Canvas/Elements/Geometries/Stroke/Strokes/PenStroke.swift @@ -101,7 +101,7 @@ final class PenStroke: Stroke, @unchecked Sendable { fetchRequest.predicate = NSPredicate(format: "ANY strokes == %@", stroke) do { - let erasers = try withPersistenceSync(\.backgroundContext) { context in + let erasers = try withPersistenceContext(\.backgroundContext) { context in try context.fetch(fetchRequest) } return erasers diff --git a/Memola/Persistence/Core/Persistence.swift b/Memola/Persistence/Core/Persistence.swift index 3597225..df7c3a2 100644 --- a/Memola/Persistence/Core/Persistence.swift +++ b/Memola/Persistence/Core/Persistence.swift @@ -110,9 +110,7 @@ func withPersistenceSync(_ keypath: KeyPath } } -func withPersistenceSync(_ keypath: KeyPath, _ task: @escaping (NSManagedObjectContext) throws -> T) throws -> T { +func withPersistenceContext(_ keypath: KeyPath, _ task: @escaping (NSManagedObjectContext) throws -> T) throws -> T { let context = Persistence.shared[keyPath: keypath] - return try context.performAndWait { - return try task(context) - } + return try task(context) }