Fix potential item change in background thread

sync
Laurent 1 year ago
parent 298dc6357f
commit fe78bbbe43
  1. 2
      LeStorage/StoredCollection.swift

@ -433,8 +433,10 @@ public class StoredCollection<T: Storable>: RandomAccessCollection, SomeCollecti
Task { Task {
do { do {
if let result = try await self._store.sendInsertion(instance) { if let result = try await self._store.sendInsertion(instance) {
DispatchQueue.main.async {
self._hasChanged = instance.copyFromServerInstance(result) self._hasChanged = instance.copyFromServerInstance(result)
} }
}
} catch { } catch {
Logger.error(error) Logger.error(error)
} }

Loading…
Cancel
Save