Fix potential item change in background thread

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

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

Loading…
Cancel
Save