From 379ba49fd5f2512d4c9558f4fa272bcdd10fac62 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Thu, 29 Aug 2019 11:53:36 -0500 Subject: [PATCH] Fix select position getting lost on refreshes --- iOS/MasterTimeline/MasterTimelineViewController.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/iOS/MasterTimeline/MasterTimelineViewController.swift b/iOS/MasterTimeline/MasterTimelineViewController.swift index 7e881cab8..647dcc175 100644 --- a/iOS/MasterTimeline/MasterTimelineViewController.swift +++ b/iOS/MasterTimeline/MasterTimelineViewController.swift @@ -475,10 +475,11 @@ private extension MasterTimelineViewController { } func performBlockAndRestoreSelection(_ block: (() -> Void)) { - let indexPaths = tableView.indexPathsForSelectedRows + let article = coordinator.currentArticle block() - indexPaths?.forEach { [weak self] indexPath in - self?.tableView.selectRow(at: indexPath, animated: false, scrollPosition: .none) + if let articleID = article?.articleID, let index = coordinator.indexesForArticleIDs(Set([articleID])).first { + let indexPath = IndexPath(row: index, section: 0) + tableView.selectRow(at: indexPath, animated: false, scrollPosition: .middle) } }