From b1dd65d7175683acfd1c6a09b095b2938836b21c Mon Sep 17 00:00:00 2001 From: Jules Rosser Date: Tue, 7 Mar 2023 15:26:16 +0000 Subject: [PATCH] improve property lookup with lodash --- src/libs/ReportActionsUtils.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libs/ReportActionsUtils.js b/src/libs/ReportActionsUtils.js index cb7ec4df6c2c..df55ae49faee 100644 --- a/src/libs/ReportActionsUtils.js +++ b/src/libs/ReportActionsUtils.js @@ -82,8 +82,7 @@ function getSortedReportActions(reportActions, shouldSortInDescendingOrder = fal * @returns {String} */ function getMostRecentIOURequestActionID(reportActions) { - const iouRequestActions = _.filter(reportActions, action => action.originalMessage - && action.originalMessage.type && action.originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.CREATE); + const iouRequestActions = _.filter(reportActions, action => lodashGet(action, 'originalMessage.type') === CONST.IOU.REPORT_ACTION_TYPE.CREATE); if (_.isEmpty(iouRequestActions)) { return null;