Skip to content

Commit

Permalink
Address final fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jjoyce0510 committed Oct 4, 2023
1 parent 03570b8 commit 5f14882
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions datahub-web-react/src/app/search/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import RecommendedOption from './autoComplete/RecommendedOption';
import SectionHeader, { EntityTypeLabel } from './autoComplete/SectionHeader';
import { useUserContext } from '../context/useUserContext';
import { navigateToSearchUrl } from './utils/navigateToSearchUrl';
import { getQuickFilterDetails } from './autoComplete/quickFilters/utils';
import ViewAllSearchItem from './ViewAllSearchItem';
import { ViewSelect } from '../entity/view/select/ViewSelect';
import { combineSiblingsInAutoComplete } from './utils/combineSiblingsInAutoComplete';
Expand Down Expand Up @@ -204,23 +203,16 @@ export const SearchBar = ({
const { quickFilters, selectedQuickFilter, setSelectedQuickFilter } = useQuickFiltersContext();

const autoCompleteQueryOptions = useMemo(() => {
const query = suggestions.length ? effectiveQuery : '';
const selectedQuickFilterLabel =
showQuickFilters && selectedQuickFilter
? getQuickFilterDetails(selectedQuickFilter, entityRegistry).label
: '';
const text = query || selectedQuickFilterLabel;

if (!text) return [];
if (effectiveQuery === '') return [];

return [
{
value: `${EXACT_SEARCH_PREFIX}${text}`,
label: <ViewAllSearchItem searchTarget={text} />,
value: `${EXACT_SEARCH_PREFIX}${effectiveQuery}`,
label: <ViewAllSearchItem searchTarget={effectiveQuery} />,
type: EXACT_AUTOCOMPLETE_OPTION_TYPE,
},
];
}, [showQuickFilters, suggestions.length, effectiveQuery, selectedQuickFilter, entityRegistry]);
}, [effectiveQuery]);

const autoCompleteEntityOptions = useMemo(() => {
return suggestions.map((suggestion: AutoCompleteResultForEntity) => {
Expand Down

0 comments on commit 5f14882

Please sign in to comment.