From 77ab2c3753879af75eda98015d40cc12dc895e82 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sun, 4 Dec 2022 22:03:48 -0500 Subject: [PATCH] Fix Trending Posts reloading on every appearance --- .../Screens/Explore/TrendingStatusesViewController.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Tusker/Screens/Explore/TrendingStatusesViewController.swift b/Tusker/Screens/Explore/TrendingStatusesViewController.swift index 6166539d..988c5302 100644 --- a/Tusker/Screens/Explore/TrendingStatusesViewController.swift +++ b/Tusker/Screens/Explore/TrendingStatusesViewController.swift @@ -18,6 +18,8 @@ class TrendingStatusesViewController: UIViewController { } private var dataSource: UICollectionViewDiffableDataSource! + private var loaded = false + init(mastodonController: MastodonController) { self.mastodonController = mastodonController @@ -89,7 +91,10 @@ class TrendingStatusesViewController: UIViewController { dataSource.apply(snapshot, animatingDifferences: false) Task { - await loadTrendingStatuses() + if !loaded { + loaded = true + await loadTrendingStatuses() + } } }