Avoid batch updates in updateLastViewedThread
This commit is contained in:
parent
3175edfbf4
commit
20ce9381d0
@ -43,8 +43,6 @@ public extension ChatListViewController {
|
||||
// just-selected index path, so update the selection once more to
|
||||
// reflect the loaded data.
|
||||
ensureSelectedThread(thread, animated: animated)
|
||||
|
||||
tableView.scrollToNearestSelectedRow(at: .none, animated: animated)
|
||||
}
|
||||
|
||||
/// Verifies that the currently selected cell matches the provided thread.
|
||||
@ -62,15 +60,14 @@ public extension ChatListViewController {
|
||||
let selectedIndexPath = selectedIndexPaths.first
|
||||
let selectedThread = selectedIndexPath.flatMap(renderState.thread(forIndexPath:))
|
||||
|
||||
tableView.performBatchUpdates {
|
||||
viewState.lastSelectedThreadId = targetThread.uniqueId
|
||||
viewState.lastSelectedThreadId = targetThread.uniqueId
|
||||
|
||||
if let selectedIndexPath, selectedThread?.uniqueId != targetThread.uniqueId {
|
||||
tableView.deselectRow(at: selectedIndexPath, animated: animated)
|
||||
}
|
||||
|
||||
if let targetIndexPath = renderState.indexPath(forUniqueId: targetThread.uniqueId) {
|
||||
tableView.selectRow(at: targetIndexPath, animated: animated, scrollPosition: .none)
|
||||
if selectedThread?.uniqueId != targetThread.uniqueId {
|
||||
if let targetPath = tableDataSource.renderState.indexPath(forUniqueId: targetThread.uniqueId) {
|
||||
tableView.selectRow(at: targetPath, animated: animated, scrollPosition: .none)
|
||||
tableView.scrollToRow(at: targetPath, at: .none, animated: animated)
|
||||
} else if let stalePath = selectedIndexPath {
|
||||
tableView.deselectRow(at: stalePath, animated: animated)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user