Fix submission of empty search queries (#1769)

Fixes submission of OmniSearch with an empty query or one which contains only a single character.
This commit is contained in:
Sebastian Sdorra
2021-08-16 13:11:44 +02:00
committed by GitHub
parent 928439b4d5
commit 8330f8fddd
2 changed files with 6 additions and 2 deletions

View File

@@ -353,8 +353,10 @@ const OmniSearch: FC = () => {
const clearQuery = () => setQuery("");
const gotoDetailSearch = () => {
history.push(`/search/${searchType}/?q=${query}`);
hideResults();
if (query.length > 1) {
history.push(`/search/${searchType}/?q=${query}`);
hideResults();
}
};
const { onKeyDown, index } = useKeyBoardNavigation(gotoDetailSearch, clearQuery, data?._embedded.hits);