Fix issue with tryPutBeforeUpdating

sync_v2
Laurent 7 months ago
parent a8b79cc402
commit 4686a42a80
  1. 7
      LeStorage/StoredSingleton.swift

@ -27,10 +27,11 @@ public class StoredSingleton<T: SyncedStorable>: SyncedCollection<T> {
return self.items.first return self.items.first
} }
@discardableResult public func tryPutBeforeUpdating(_ instance: T) async throws -> T? { public func tryPutBeforeUpdating(_ instance: T) async throws {
let result = try await StoreCenter.main.service().rawPut(instance) let result = try await StoreCenter.main.service().rawPut(instance)
self.setItemNoSync(result) if let item = self.item() {
return result item.copy(from: result)
}
} }
// MARK: - Protects from use // MARK: - Protects from use

Loading…
Cancel
Save