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
}
@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)
self.setItemNoSync(result)
return result
if let item = self.item() {
item.copy(from: result)
}
}
// MARK: - Protects from use

Loading…
Cancel
Save