Actually only restore existing statuses

This commit is contained in:
Shadowfacts 2022-12-08 20:15:12 -05:00
parent f96acd33f2
commit 4f48514d1a
1 changed files with 2 additions and 2 deletions

View File

@ -315,11 +315,11 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
controller.restoreInitial {
var snapshot = dataSource.snapshot()
snapshot.appendSections([.statuses])
let items = statusIDs.map { Item.status(id: $0, collapseState: .unknown, filterState: .unknown) }
let items = existingStatuses.map { Item.status(id: $0, collapseState: .unknown, filterState: .unknown) }
snapshot.appendItems(items, toSection: .statuses)
dataSource.apply(snapshot, animatingDifferences: false) {
if let centerID = activity.userInfo?["centerID"] as? String ?? activity.userInfo?["topID"] as? String,
let index = statusIDs.firstIndex(of: centerID),
let index = existingStatuses.firstIndex(of: centerID),
let indexPath = self.dataSource.indexPath(for: items[index]) {
// it sometimes takes multiple attempts to convert on the right scroll position
// since we're dealing with a bunch of unmeasured cells, so just try a few times in a loop