From 8338bf7ac88bc092e416f87f125feeb21608b3fc Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Tue, 6 Oct 2020 13:58:12 -0400 Subject: [PATCH] interface: remove duplicate result for exact query --- pkg/interface/src/views/components/DropdownSearch.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/interface/src/views/components/DropdownSearch.tsx b/pkg/interface/src/views/components/DropdownSearch.tsx index 394f52d68..3c70877dd 100644 --- a/pkg/interface/src/views/components/DropdownSearch.tsx +++ b/pkg/interface/src/views/components/DropdownSearch.tsx @@ -118,7 +118,10 @@ export function DropdownSearch(props: DropdownSearchProps) { const dropdown = useMemo(() => { const first = props.isExact(query); - const opts = first ? [first, ...options] : options; + let opts = options; + if (first) { + opts = options.includes(first) ? opts : [first, ...options]; + } return _.take(opts, 5).map((o, idx) => props.renderCandidate( o,