Search- Search result does not appear if user searches apart from the first word in the user or channel name.
Ex- If user name is “John Doe”, then if we search Doe then result does not appear.
const onQueryChannel = useCallback(
async (query: string | undefined = undefined, isDirectChannel = false) => {
setState(prev => ({...prev, isSearching: true, isLoading: true}));
try {
let displayName = query;
if (isDirectChannel && query) {
displayName = `${session_info.name}:${query}`;
}
const data = ChannelRepository.getChannels(
{
sortBy: 'lastActivity',
limit: 40,
membership: membership,
isDeleted: false,
tags: filterTags,
excludeTags: [...getEnvChannelExcludeTags()],
displayName: displayName,
types: isDirectChannel
? ['conversation']
: ['community', 'broadcast', 'live'],
},
value => setChannels(value, isDirectChannel),
);
if (data) {
disposers.current.push(data);
}
} catch (error) {
setChannels([], isDirectChannel);
}
},
[filterTags, membership, setChannels, session_info],
);