Skip to content

Commit

Permalink
fix: prevent ignoring the clearSearchOnClickOutside search param on m…
Browse files Browse the repository at this point in the history
…obile (#2039)
  • Loading branch information
arnautov-anton authored Jul 9, 2023
1 parent d2ad5eb commit e83d313
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/ChannelSearch/hooks/useChannelSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const useChannelSearch = <
searchQueryParams,
setChannels,
}: ChannelSearchControllerParams<StreamChatGenerics>): SearchController<StreamChatGenerics> => {
const { client, navOpen, setActiveChannel, themeVersion } = useChatContext<StreamChatGenerics>(
const { client, setActiveChannel, themeVersion } = useChatContext<StreamChatGenerics>(
'useChannelSearch',
);

Expand Down Expand Up @@ -141,14 +141,14 @@ export const useChannelSearch = <

if (isInputClick) return;

if ((inputIsFocused && (!query || navOpen)) || clearSearchOnClickOutside) {
if ((inputIsFocused && !query) || clearSearchOnClickOutside) {
exitSearch();
}
};

document.addEventListener('click', clickListener);
return () => document.removeEventListener('click', clickListener);
}, [disabled, inputIsFocused, query, exitSearch, navOpen, clearSearchOnClickOutside]);
}, [disabled, inputIsFocused, query, exitSearch, clearSearchOnClickOutside]);

useEffect(() => {
if (!inputRef.current || disabled) return;
Expand Down

0 comments on commit e83d313

Please sign in to comment.