diff --git a/Signal/src/ViewControllers/HomeView/Chat List/ChatListViewController+Helpers.swift b/Signal/src/ViewControllers/HomeView/Chat List/ChatListViewController+Helpers.swift index b7b0e0d173..80b7d3ae8e 100644 --- a/Signal/src/ViewControllers/HomeView/Chat List/ChatListViewController+Helpers.swift +++ b/Signal/src/ViewControllers/HomeView/Chat List/ChatListViewController+Helpers.swift @@ -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) } } }