From 76e67a33cde0e9ed64c5039632b51ee7e5c7e19a Mon Sep 17 00:00:00 2001 From: Josh Slaughter Date: Thu, 29 Jun 2023 16:06:10 -0700 Subject: [PATCH] frontend: Fixing Search Issue --- frontend/packages/core/src/AppLayout/search.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/frontend/packages/core/src/AppLayout/search.tsx b/frontend/packages/core/src/AppLayout/search.tsx index b4cbf6c15b..cb67fb3d23 100644 --- a/frontend/packages/core/src/AppLayout/search.tsx +++ b/frontend/packages/core/src/AppLayout/search.tsx @@ -188,11 +188,8 @@ const Result: React.FC = ({ option, handleSelection }) => ( ); -const filterResults = (searchOptions: SearchIndex[], state: FilterOptionsState) => { - return _.filter(searchOptions, o => { - return o.label.toLowerCase().includes(state.inputValue.toLowerCase()); - }); -}; +const filterResults = (searchOptions: SearchIndex[], state: FilterOptionsState) => + _.filter(searchOptions, o => o.label.toLowerCase().includes(state.inputValue.toLowerCase())); const SearchField: React.FC = () => { const { workflows } = useAppContext(); @@ -222,12 +219,13 @@ const SearchField: React.FC = () => { setShowOptions(true); setInputValue(value); } - const option = _.find(options, o => { - return o.label === value; - }); + + // If full match will auto navigate user to the workflow + const option = _.find(options, o => o.label.toLowerCase() === value.toLowerCase()); if (option !== undefined) { setShowOptions(false); setInputValue(""); + navigate(option.path); } };