Don't update feed selection for zero rows.

This commit is contained in:
Maurice Parker 2019-09-12 13:49:23 -05:00
parent 2737f07906
commit 979fcbc013
1 changed files with 8 additions and 6 deletions

View File

@ -452,12 +452,14 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
}
func updateFeedSelection() {
if let indexPath = coordinator.currentFeedIndexPath {
if tableView.indexPathForSelectedRow != indexPath {
tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: true, deselect: coordinator.isRootSplitCollapsed)
if dataSource.snapshot().numberOfItems > 0 {
if let indexPath = coordinator.currentFeedIndexPath {
if tableView.indexPathForSelectedRow != indexPath {
tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: true, deselect: coordinator.isRootSplitCollapsed)
}
} else {
tableView.selectRow(at: nil, animated: true, scrollPosition: .none)
}
} else {
tableView.selectRow(at: nil, animated: true, scrollPosition: .none)
}
}
@ -495,7 +497,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
}
if let indexPath = dataSource.indexPath(for: node) {
tableView.scrollToRow(at: indexPath, at: .middle, animated: true)
tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: true)
coordinator.selectFeed(indexPath)
completion?()
return