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

View File

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