Fix crash due to Explore data source being update off main thread when list deleted
This commit is contained in:
parent
e8576277e0
commit
43d8434e17
|
@ -261,13 +261,16 @@ class ExploreViewController: UIViewController, UICollectionViewDelegate, Collect
|
|||
}
|
||||
|
||||
private func deleteList(_ list: List, completion: @escaping (Bool) -> Void) {
|
||||
Task { @MainActor in
|
||||
Task {
|
||||
let service = DeleteListService(list: list, mastodonController: mastodonController, present: { self.present($0, animated: true) })
|
||||
if await service.run() {
|
||||
var snapshot = dataSource.snapshot()
|
||||
snapshot.deleteItems([.list(list)])
|
||||
await dataSource.apply(snapshot)
|
||||
completion(true)
|
||||
await MainActor.run {
|
||||
dataSource.apply(snapshot, animatingDifferences: true) {
|
||||
completion(true)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
completion(false)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue