From 7254e5ac2fcd8e777d04aa5782f9ac2b0dba67ce Mon Sep 17 00:00:00 2001 From: Samuel Herodotou Date: Wed, 11 Oct 2023 18:19:04 +0100 Subject: [PATCH] Combined map and filter --- src/pages/workspace/WorkspaceInvitePage.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/pages/workspace/WorkspaceInvitePage.js b/src/pages/workspace/WorkspaceInvitePage.js index bed146528610..8986ddccc0e3 100644 --- a/src/pages/workspace/WorkspaceInvitePage.js +++ b/src/pages/workspace/WorkspaceInvitePage.js @@ -84,17 +84,13 @@ function WorkspaceInvitePage(props) { useEffect(() => { let emails = searchTerm.replace(/\s,\s/g, ',').split(','); - emails = _.map(emails, word => word.trim()); + emails = _.filter(_.map(emails, word => word.trim()), email => email !== ''); const newUsersToInviteDict = {}; const newPersonalDetailsDict = {}; const newSelectedOptionsDict = {}; _.forEach(emails, (email) => { - if (email === '') { - return; - } - const inviteOptions = OptionsListUtils.getMemberInviteOptions(props.personalDetails, props.betas, email, excludedUsers); // Update selectedOptions with the latest personalDetails and policyMembers information