mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-18 14:16:48 +00:00
fix(search): have search bar ignore blank searches (#2556)
This commit is contained in:
parent
66d79be4b1
commit
5de346b7ad
@ -115,6 +115,9 @@ export const HomePageHeader = () => {
|
|||||||
const isAnalyticsEnabled = data && data.isAnalyticsEnabled;
|
const isAnalyticsEnabled = data && data.isAnalyticsEnabled;
|
||||||
|
|
||||||
const onSearch = (query: string) => {
|
const onSearch = (query: string) => {
|
||||||
|
if (query.trim().length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
analytics.event({
|
analytics.event({
|
||||||
type: EventType.SearchEvent,
|
type: EventType.SearchEvent,
|
||||||
query,
|
query,
|
||||||
|
@ -55,6 +55,9 @@ export const SearchPage = () => {
|
|||||||
const filters: Array<FacetFilterInput> = useFilters(params);
|
const filters: Array<FacetFilterInput> = useFilters(params);
|
||||||
|
|
||||||
const onSearch = (q: string) => {
|
const onSearch = (q: string) => {
|
||||||
|
if (query.trim().length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
analytics.event({
|
analytics.event({
|
||||||
type: EventType.SearchEvent,
|
type: EventType.SearchEvent,
|
||||||
query: q,
|
query: q,
|
||||||
|
@ -38,6 +38,9 @@ export const SearchablePage = ({ initialQuery, onSearch, onAutoComplete, childre
|
|||||||
const [getAutoCompleteResults, { data: suggestionsData }] = useGetAutoCompleteResultsLazyQuery();
|
const [getAutoCompleteResults, { data: suggestionsData }] = useGetAutoCompleteResultsLazyQuery();
|
||||||
|
|
||||||
const search = (query: string) => {
|
const search = (query: string) => {
|
||||||
|
if (query.trim().length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
analytics.event({
|
analytics.event({
|
||||||
type: EventType.SearchEvent,
|
type: EventType.SearchEvent,
|
||||||
query,
|
query,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user