Skip to content

Commit

Permalink
bfix: fix repetition in recent searches
Browse files Browse the repository at this point in the history
- Duplicate users were added on repeated queries
  • Loading branch information
NanoNish committed Nov 8, 2022
1 parent 2acf10b commit 961853d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/presentation/search/bloc/search_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ class SearchBloc extends Bloc<SearchEvent, SearchState> {
void _onRecentSearch(RecentSearch event, Emitter<SearchState> emit) {
final recent = state.recentSearches;
if (event.toAdd) {
recent.insert(0, event.user);
if (!recent.contains(event.user)) {
recent.insert(0, event.user);
}
} else {
recent.remove(event.user);
}
Expand Down

0 comments on commit 961853d

Please sign in to comment.