From e6f1968609c6003b0b29d3ddacd303e4061ac464 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sun, 5 Nov 2023 18:22:20 -0500 Subject: [PATCH] Fix TimelineLikeCollectionViewController.apply not actually applying snapshots on the main thread --- .../Utilities/TimelineLikeCollectionViewController.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Tusker/Screens/Utilities/TimelineLikeCollectionViewController.swift b/Tusker/Screens/Utilities/TimelineLikeCollectionViewController.swift index 697e6b35..8239f09a 100644 --- a/Tusker/Screens/Utilities/TimelineLikeCollectionViewController.swift +++ b/Tusker/Screens/Utilities/TimelineLikeCollectionViewController.swift @@ -211,9 +211,10 @@ extension TimelineLikeCollectionViewController { extension TimelineLikeCollectionViewController { // apply(_:animatingDifferences:) is marked as nonisolated, so just awaiting it doesn't dispatch to the main thread, unlike other async @MainActor methods // but we always want to update the data source on the main thread for consistency, so this method does that - @MainActor func apply(_ snapshot: NSDiffableDataSourceSnapshot, animatingDifferences: Bool) async { - await self.dataSource.apply(snapshot, animatingDifferences: animatingDifferences) + await MainActor.run { + dataSource?.apply(snapshot, animatingDifferences: animatingDifferences) + } } @MainActor