-
Notifications
You must be signed in to change notification settings - Fork 356
Open
Labels
Description
Working on collections/changesets I found a possible issue:
case .next(let element):
let newCollection = element
if let collection = collection {
let diff = generateDiff(collection, newCollection)
observer.receive(OrderedCollectionChangeset(collection: newCollection, patch: [], diff: diff))
} else {
observer.receive(OrderedCollectionChangeset(collection: newCollection, patch: []))
}
collection = newCollectionLine:
observer.receive(OrderedCollectionChangeset(collection: newCollection, patch: [], diff: diff))
I think this is a mistake. You shouldn't pass patch option there.
Then this patch will be used here:
open func apply(changeset: Changeset) {
guard let tableView = tableView else { return }
let patch = changeset.patch
if patch.isEmpty {
collection = clone(changeset.collection)
tableView.reloadData()
} else {
tableView.beginUpdates()
patch.forEach(apply)
tableView.endUpdates()
}
}And as far as it's empty it always reloadData.