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) {
|
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) })
|
let service = DeleteListService(list: list, mastodonController: mastodonController, present: { self.present($0, animated: true) })
|
||||||
if await service.run() {
|
if await service.run() {
|
||||||
var snapshot = dataSource.snapshot()
|
var snapshot = dataSource.snapshot()
|
||||||
snapshot.deleteItems([.list(list)])
|
snapshot.deleteItems([.list(list)])
|
||||||
await dataSource.apply(snapshot)
|
await MainActor.run {
|
||||||
|
dataSource.apply(snapshot, animatingDifferences: true) {
|
||||||
completion(true)
|
completion(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
completion(false)
|
completion(false)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue