diff --git a/Tusker/Screens/Timeline/TimelineTableViewController.swift b/Tusker/Screens/Timeline/TimelineTableViewController.swift index fb39aed35e..e1f3117f4f 100644 --- a/Tusker/Screens/Timeline/TimelineTableViewController.swift +++ b/Tusker/Screens/Timeline/TimelineTableViewController.swift @@ -179,11 +179,12 @@ class TimelineTableViewController: EnhancedTableViewController { mastodonController.run(request) { response in guard case let .success(newStatuses, pagination) = response else { fatalError() } self.older = pagination?.older - let newRows = self.timelineSegments.last!.count..<(self.timelineSegments.last!.count + newStatuses.count) - let newIndexPaths = newRows.map { IndexPath(row: $0, section: self.timelineSegments.count - 1) } - self.timelineSegments[self.timelineSegments.count - 1].append(contentsOf: newStatuses.map { ($0.id, .unknown) }) self.mastodonController.persistentContainer.addAll(statuses: newStatuses) { DispatchQueue.main.async { + let newRows = self.timelineSegments.last!.count..<(self.timelineSegments.last!.count + newStatuses.count) + let newIndexPaths = newRows.map { IndexPath(row: $0, section: self.timelineSegments.count - 1) } + self.timelineSegments[self.timelineSegments.count - 1].append(contentsOf: newStatuses.map { ($0.id, .unknown) }) + UIView.performWithoutAnimation { self.tableView.insertRows(at: newIndexPaths, with: .none) }