diff --git a/Tusker/Screens/Timeline/TimelineViewController.swift b/Tusker/Screens/Timeline/TimelineViewController.swift index bf6b03ed..aa14aaa9 100644 --- a/Tusker/Screens/Timeline/TimelineViewController.swift +++ b/Tusker/Screens/Timeline/TimelineViewController.swift @@ -364,6 +364,8 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro ] SentrySDK.addBreadcrumb(crumb: crumb) }() + let originalPositionStatusIDs = position.statusIDs + let unloaded = position.statusIDs.filter({ mastodonController.persistentContainer.status(for: $0) == nil }) guard !unloaded.isEmpty else { return true @@ -420,6 +422,14 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro SentrySDK.addBreadcrumb(crumb: crumb) }() + // if an icloud sync completed in between starting to load the statuses and finishing, try to load again + if position.statusIDs != originalPositionStatusIDs { + let crumb = Breadcrumb(level: .info, category: "TimelineViewController") + crumb.message = "TimelinePosition statusIDs changed, retrying load" + SentrySDK.addBreadcrumb(crumb: crumb) + return await loadStatusesToRestore(position: position) + } + // update the timeline position in case some statuses couldn't be loaded if let center = position.centerStatusID { let nearestLoadedStatusToCenter = position.statusIDs[position.statusIDs.firstIndex(of: center)!...].first(where: { id in