From fad9409cc67060e425f1159c0178ae0924e94c88 Mon Sep 17 00:00:00 2001 From: Ruben Olano Date: Sat, 23 Nov 2024 18:33:39 -0600 Subject: [PATCH] get rid of build error --- src/components/searchBar/DebouncedSearchBar.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/searchBar/DebouncedSearchBar.tsx b/src/components/searchBar/DebouncedSearchBar.tsx index 6e16af7..334c1dd 100644 --- a/src/components/searchBar/DebouncedSearchBar.tsx +++ b/src/components/searchBar/DebouncedSearchBar.tsx @@ -59,8 +59,9 @@ export const DebouncedSearchBar = ({ setSelectedIndex(Math.max(selectedIndex - 1, 0)); break; case 'Enter': - if (searchResults && searchResults[selectedIndex]) { - onClick?.(searchResults[selectedIndex]); + const selectedItem = searchResults?.[selectedIndex]; + if (selectedItem) { + onClick?.(selectedItem); } break; }