fix: duplicate auto complete items may crash the app issue

This commit is contained in:
CMK 2022-05-13 13:59:54 +08:00
parent 975f8205d2
commit 2784fb8771
1 changed files with 1 additions and 1 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: