Skip to content

Commit

Permalink
search subscription using fname field too
Browse files Browse the repository at this point in the history
  • Loading branch information
yash-rajpal committed Sep 21, 2023
1 parent 306761e commit 51b2c65
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ const UserAndRoomAutoCompleteMultiple = ({ value, onChange, ...props }: UserAndR
const debouncedFilter = useDebouncedValue(filter, 1000);

const rooms = useUserSubscriptions(
useMemo(() => ({ open: { $ne: false }, lowerCaseName: new RegExp(escapeRegExp(debouncedFilter), 'i') }), [debouncedFilter]),
useMemo(
() => ({
open: { $ne: false },
$or: [{ lowerCaseName: new RegExp(escapeRegExp(debouncedFilter), 'i') }, { fname: new RegExp(escapeRegExp(debouncedFilter), 'i') }],
}),
[debouncedFilter],
),
).filter((room) => {
if (!user) {
return;
Expand Down

0 comments on commit 51b2c65

Please sign in to comment.