Fix Trending Posts reloading on every appearance

This commit is contained in:
Shadowfacts 2022-12-04 22:03:48 -05:00
parent b90262bfd0
commit 77ab2c3753
1 changed files with 6 additions and 1 deletions

View File

@ -18,6 +18,8 @@ class TrendingStatusesViewController: UIViewController {
} }
private var dataSource: UICollectionViewDiffableDataSource<Section, Item>! private var dataSource: UICollectionViewDiffableDataSource<Section, Item>!
private var loaded = false
init(mastodonController: MastodonController) { init(mastodonController: MastodonController) {
self.mastodonController = mastodonController self.mastodonController = mastodonController
@ -89,7 +91,10 @@ class TrendingStatusesViewController: UIViewController {
dataSource.apply(snapshot, animatingDifferences: false) dataSource.apply(snapshot, animatingDifferences: false)
Task { Task {
await loadTrendingStatuses() if !loaded {
loaded = true
await loadTrendingStatuses()
}
} }
} }