Only try to restore statuses that exist in the cache

This could result in discontinuities in the restored timeline, but I'm
not sure there's anything better we could do.
This commit is contained in:
Shadowfacts 2022-12-04 17:34:28 -05:00
parent 41775e5d19
commit 5f3d9da9f8
1 changed files with 4 additions and 0 deletions

View File

@ -292,6 +292,10 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
return false return false
} }
activityToRestore = nil activityToRestore = nil
let existingStatuses = statusIDs.filter { mastodonController.persistentContainer.status(for: $0) != nil }
guard !existingStatuses.isEmpty else {
return false
}
loadViewIfNeeded() loadViewIfNeeded()
controller.restoreInitial { controller.restoreInitial {
var snapshot = dataSource.snapshot() var snapshot = dataSource.snapshot()