diff --git a/client/utils/index.ts b/client/utils/index.ts index 23bae4fb0..38d167fd9 100644 --- a/client/utils/index.ts +++ b/client/utils/index.ts @@ -547,8 +547,9 @@ export const getItemsById = (ids, items) => ( export const getUsersForDesk = (desk, globalUserList = []) => { if (!desk) return globalUserList; - return globalUserList.filter((user) => - map(desk.members, 'user').indexOf(user._id) !== -1); + const deskMembersSet = new Set((desk.members ?? []).map((member) => member.user)); + + return globalUserList.filter(({_id}) => deskMembersSet.has(_id)); }; export const getDesksForUser = (user, desksList = []) => {