Fix Trending Posts reloading on every appearance
This commit is contained in:
parent
b90262bfd0
commit
77ab2c3753
|
@ -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,9 +91,12 @@ class TrendingStatusesViewController: UIViewController {
|
||||||
dataSource.apply(snapshot, animatingDifferences: false)
|
dataSource.apply(snapshot, animatingDifferences: false)
|
||||||
|
|
||||||
Task {
|
Task {
|
||||||
|
if !loaded {
|
||||||
|
loaded = true
|
||||||
await loadTrendingStatuses()
|
await loadTrendingStatuses()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private func loadTrendingStatuses() async {
|
private func loadTrendingStatuses() async {
|
||||||
let statuses: [Status]
|
let statuses: [Status]
|
||||||
|
|
Loading…
Reference in New Issue