Merge pull request #432 from mastodon/fix-auto-complete-crash

Fix auto complete items may raise crash issue
This commit is contained in:
CMK 2022-05-13 15:33:00 +08:00 committed by GitHub
commit 3bdd9dc4aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -46,7 +46,7 @@ final class AutoCompleteViewModel {
var snapshot = NSDiffableDataSourceSnapshot<AutoCompleteSection, AutoCompleteItem>()
snapshot.appendSections([.main])
snapshot.appendItems(items, toSection: .main)
snapshot.appendItems(items.removingDuplicates(), toSection: .main)
if let currentState = self.stateMachine.currentState {
switch currentState {
case is State.Loading, is State.Fail:

View File

@ -32,7 +32,7 @@ extension DiscoveryHashtagsViewModel {
snapshot.appendSections([.hashtags])
let items = hashtags.map { DiscoveryItem.hashtag($0) }
snapshot.appendItems(items, toSection: .hashtags)
snapshot.appendItems(items.removingDuplicates(), toSection: .hashtags)
diffableDataSource.apply(snapshot)
}