Skip to content

Commit

Permalink
fix: adding optional chaining to a statement in the search component …
Browse files Browse the repository at this point in the history
…to fix an edge case (#463)
  • Loading branch information
lloydaf authored Aug 23, 2024
1 parent 287f4f7 commit c895bb3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/Search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export const Search: FC<SearchProps> = ({
// 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);
Expand Down

0 comments on commit c895bb3

Please sign in to comment.