Skip to content

Commit

Permalink
Make default search language 'all languages' (#5731)
Browse files Browse the repository at this point in the history
  • Loading branch information
pfrazee authored Oct 11, 2024
1 parent 157011e commit e53b972
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/view/screens/Search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -436,19 +436,16 @@ function SearchLanguageDropdown({
}

function useQueryManager({initialQuery}: {initialQuery: string}) {
const {contentLanguages} = useLanguagePrefs()
const {query, params: initialParams} = React.useMemo(() => {
return parseSearchQuery(initialQuery || '')
}, [initialQuery])
const prevInitialQuery = React.useRef(initialQuery)
const [lang, setLang] = React.useState(
initialParams.lang || contentLanguages[0],
)
const [lang, setLang] = React.useState(initialParams.lang || '')

if (initialQuery !== prevInitialQuery.current) {
// handle new queryParam change (from manual search entry)
prevInitialQuery.current = initialQuery
setLang(initialParams.lang || contentLanguages[0])
setLang(initialParams.lang || '')
}

const params = React.useMemo(
Expand Down

0 comments on commit e53b972

Please sign in to comment.