Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Apr 27, 2024
1 parent 812dc37 commit 347d573
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/view/screens/Search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,11 @@ export function SearchScreen(
const updateSearchHistory = React.useCallback(
async (newQuery: string) => {
newQuery = newQuery.trim()
if (newQuery && !searchHistory.includes(newQuery)) {
let newHistory = [newQuery, ...searchHistory]
if (newQuery) {
let newHistory = [
newQuery,
...searchHistory.filter(q => q !== newQuery),
]

if (newHistory.length > 5) {
newHistory = newHistory.slice(0, 5)
Expand Down Expand Up @@ -757,6 +760,8 @@ export function SearchScreen(
onPress={() => {
if (isWeb) {
setInputIsFocused(false)
} else {
textInput.current?.blur()
}
}}
/>
Expand Down

0 comments on commit 347d573

Please sign in to comment.