diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 654bc7054cb2..b5001c39a759 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -628,12 +628,6 @@ function getOptions( }; } - // We're only picking personal details that have logins set - // This is a temporary fix for all the logic that's been breaking because of the new privacy changes - // See https://github.com/Expensify/Expensify/issues/293465 for more context - // eslint-disable-next-line no-param-reassign - personalDetails = !includeP2P ? {} : _.pick(personalDetails, (detail) => Boolean(detail.login)); - let recentReportOptions = []; let personalDetailsOptions = []; const reportMapForAccountIDs = {}; @@ -714,7 +708,12 @@ function getOptions( ); }); - let allPersonalDetailsOptions = _.map(personalDetails, (personalDetail) => + // We're only picking personal details that have logins set + // This is a temporary fix for all the logic that's been breaking because of the new privacy changes + // See https://github.com/Expensify/Expensify/issues/293465 for more context + // Moreover, we should not override the personalDetails object, otherwise the createOption util won't work properly, it returns incorrect tooltipText + const havingLoginPersonalDetails = !includeP2P ? {} : _.pick(personalDetails, (detail) => Boolean(detail.login)); + let allPersonalDetailsOptions = _.map(havingLoginPersonalDetails, (personalDetail) => createOption([personalDetail.accountID], personalDetails, reportMapForAccountIDs[personalDetail.accountID], reportActions, { showChatPreviewLine, forcePolicyNamePreview,