Fix Trending Posts appearing to reload forever

This commit is contained in:
Shadowfacts 2022-12-12 22:51:50 -05:00
parent 2891f47cb3
commit 382d8ef2c8
1 changed files with 8 additions and 8 deletions

View File

@ -85,14 +85,14 @@ class TrendingStatusesViewController: UIViewController {
override func viewWillAppear(_ animated: Bool) { override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated) super.viewWillAppear(animated)
var snapshot = NSDiffableDataSourceSnapshot<Section, Item>() if !loaded {
snapshot.appendSections([.statuses]) loaded = true
snapshot.appendItems([.loadingIndicator]) var snapshot = NSDiffableDataSourceSnapshot<Section, Item>()
dataSource.apply(snapshot, animatingDifferences: false) snapshot.appendSections([.statuses])
snapshot.appendItems([.loadingIndicator])
dataSource.apply(snapshot, animatingDifferences: false)
Task { Task {
if !loaded {
loaded = true
await loadTrendingStatuses() await loadTrendingStatuses()
} }
} }