diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js index d184bd98b810..c81e0fe31a13 100644 --- a/src/pages/home/report/ReportActionItem.js +++ b/src/pages/home/report/ReportActionItem.js @@ -117,6 +117,9 @@ const propTypes = { /** The user's wallet account */ userWallet: userWalletPropTypes, + + /** All the report actions belonging to the report's parent */ + parentReportActions: PropTypes.objectOf(PropTypes.shape(reportActionPropTypes)), }; const defaultProps = { @@ -127,6 +130,7 @@ const defaultProps = { iouReport: undefined, shouldHideThreadDividerLine: false, userWallet: {}, + parentReportActions: {}, }; function ReportActionItem(props) { @@ -568,7 +572,7 @@ function ReportActionItem(props) { }; if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED) { - const parentReportAction = ReportActionsUtils.getParentReportAction(props.report); + const parentReportAction = props.parentReportActions[props.report.parentReportActionID]; if (ReportActionsUtils.isTransactionThread(parentReportAction)) { return ( @@ -767,6 +771,10 @@ export default compose( userWallet: { key: ONYXKEYS.USER_WALLET, }, + parentReportActions: { + key: ({report}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.parentReportID || 0}`, + canEvict: false, + }, }), )( memo( @@ -784,6 +792,8 @@ export default compose( _.isEqual(prevProps.report.errorFields, nextProps.report.errorFields) && lodashGet(prevProps.report, 'statusNum') === lodashGet(nextProps.report, 'statusNum') && lodashGet(prevProps.report, 'stateNum') === lodashGet(nextProps.report, 'stateNum') && + lodashGet(prevProps.report, 'parentReportID') === lodashGet(nextProps.report, 'parentReportID') && + lodashGet(prevProps.report, 'parentReportActionID') === lodashGet(nextProps.report, 'parentReportActionID') && prevProps.translate === nextProps.translate && // TaskReport's created actions render the TaskView, which updates depending on certain fields in the TaskReport ReportUtils.isTaskReport(prevProps.report) === ReportUtils.isTaskReport(nextProps.report) &&