fix(search): have search bar ignore blank searches (#2556)

This commit is contained in:
Gabe Lyons 2021-05-13 18:11:32 -07:00 committed by GitHub
parent 66d79be4b1
commit 5de346b7ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 0 deletions

View File

@ -115,6 +115,9 @@ export const HomePageHeader = () => {
const isAnalyticsEnabled = data && data.isAnalyticsEnabled;
const onSearch = (query: string) => {
if (query.trim().length === 0) {
return;
}
analytics.event({
type: EventType.SearchEvent,
query,

View File

@ -55,6 +55,9 @@ export const SearchPage = () => {
const filters: Array<FacetFilterInput> = useFilters(params);
const onSearch = (q: string) => {
if (query.trim().length === 0) {
return;
}
analytics.event({
type: EventType.SearchEvent,
query: q,

View File

@ -38,6 +38,9 @@ export const SearchablePage = ({ initialQuery, onSearch, onAutoComplete, childre
const [getAutoCompleteResults, { data: suggestionsData }] = useGetAutoCompleteResultsLazyQuery();
const search = (query: string) => {
if (query.trim().length === 0) {
return;
}
analytics.event({
type: EventType.SearchEvent,
query,