From 382d8ef2c891753633434027434234181b98c308 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 12 Dec 2022 22:51:50 -0500 Subject: [PATCH] Fix Trending Posts appearing to reload forever --- .../Explore/TrendingStatusesViewController.swift | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Tusker/Screens/Explore/TrendingStatusesViewController.swift b/Tusker/Screens/Explore/TrendingStatusesViewController.swift index 988c5302..34bb2a1d 100644 --- a/Tusker/Screens/Explore/TrendingStatusesViewController.swift +++ b/Tusker/Screens/Explore/TrendingStatusesViewController.swift @@ -85,14 +85,14 @@ class TrendingStatusesViewController: UIViewController { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) - var snapshot = NSDiffableDataSourceSnapshot() - snapshot.appendSections([.statuses]) - snapshot.appendItems([.loadingIndicator]) - dataSource.apply(snapshot, animatingDifferences: false) - - Task { - if !loaded { - loaded = true + if !loaded { + loaded = true + var snapshot = NSDiffableDataSourceSnapshot() + snapshot.appendSections([.statuses]) + snapshot.appendItems([.loadingIndicator]) + dataSource.apply(snapshot, animatingDifferences: false) + + Task { await loadTrendingStatuses() } }