From ba32269aa9302090efff18a9d587e2fb26ff7076 Mon Sep 17 00:00:00 2001 From: Lloyd Francis Date: Fri, 23 Aug 2024 11:44:45 +0200 Subject: [PATCH] fix: adding optional chaining to a statement in the search component to fix an edge case --- src/components/Search/Search.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Search/Search.tsx b/src/components/Search/Search.tsx index 9a8f2f2cb..aaebaef56 100644 --- a/src/components/Search/Search.tsx +++ b/src/components/Search/Search.tsx @@ -213,7 +213,7 @@ export const Search: FC = ({ // eslint-disable-next-line unicorn/consistent-function-scoping const emitIfClickingOutsideSearch = (event: DocumentEventMap['click']) => { if (disabled) return; - if (!containerRef.current.contains(event.target as Element)) { + if (!containerRef.current?.contains(event.target as Element)) { setShowResults(false); } else { setShowResults(true);