From ed5a0f3abcb747d5d7b32d0349fad036eaf2289e Mon Sep 17 00:00:00 2001 From: Nathan Mattes Date: Sun, 17 Sep 2023 15:16:25 +0200 Subject: [PATCH] Show max. 10 items in history (IOS-141) --- .../SearchHistory/SearchHistoryViewModel+Diffable.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Mastodon/Scene/Search/SearchDetail/SearchHistory/SearchHistoryViewModel+Diffable.swift b/Mastodon/Scene/Search/SearchDetail/SearchHistory/SearchHistoryViewModel+Diffable.swift index 92b70bf99..26f8f572f 100644 --- a/Mastodon/Scene/Search/SearchDetail/SearchHistory/SearchHistoryViewModel+Diffable.swift +++ b/Mastodon/Scene/Search/SearchDetail/SearchHistory/SearchHistoryViewModel+Diffable.swift @@ -53,10 +53,12 @@ extension SearchHistoryViewModel { return users + hashtags } + + let mostRecentItems = Array(items.prefix(10)) var snapshot = NSDiffableDataSourceSnapshot() snapshot.appendSections([.main]) - snapshot.appendItems(items, toSection: .main) - await diffableDataSource.apply(snapshot, animatingDifferences: false) + snapshot.appendItems(mostRecentItems, toSection: .main) + await diffableDataSource.apply(snapshot, animatingDifferences: true) } catch { // do nothing }