Merge branch 'develop' into new.drawer-omnichannel

This commit is contained in:
Gerzon Z 2022-04-26 14:48:46 -04:00
commit 1778f34198
1 changed files with 4 additions and 1 deletions

View File

@ -32,7 +32,10 @@ const SelectUsers = ({
const getUsers = debounce(async (keyword = '') => {
try {
const res = await RocketChat.search({ text: keyword, filterRooms: false });
setUsers(res);
const selectedUsers = users.filter((u: IUser) => selected.includes(u.name));
const filteredUsers = res.filter(r => !users.find((u: IUser) => u.name === r.name));
const items = [...selectedUsers, ...filteredUsers];
setUsers(items);
} catch {
// do nothing
}