From 5f3d9da9f8d9636d33e174533dfe7e9f9876e60e Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sun, 4 Dec 2022 17:34:28 -0500 Subject: [PATCH] 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. --- Tusker/Screens/Timeline/TimelineViewController.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Tusker/Screens/Timeline/TimelineViewController.swift b/Tusker/Screens/Timeline/TimelineViewController.swift index 57ebd37c..65285c78 100644 --- a/Tusker/Screens/Timeline/TimelineViewController.swift +++ b/Tusker/Screens/Timeline/TimelineViewController.swift @@ -292,6 +292,10 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro return false } activityToRestore = nil + let existingStatuses = statusIDs.filter { mastodonController.persistentContainer.status(for: $0) != nil } + guard !existingStatuses.isEmpty else { + return false + } loadViewIfNeeded() controller.restoreInitial { var snapshot = dataSource.snapshot()