From 68f747a0ed1b37e1fc833895c3ececaa716ecce8 Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Wed, 11 Oct 2023 08:11:07 -0600 Subject: [PATCH] Merge pull request #29227 from saranshbalyan-1234/fix-crash-on-deep-link-request-page Fix crash on deep link request page (cherry picked from commit 110993f6869c4f95d8e185a43298ba22312f7a69) --- src/pages/EditRequestPage.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/pages/EditRequestPage.js b/src/pages/EditRequestPage.js index 28e70dc1a47e..8b19c7cb7b60 100644 --- a/src/pages/EditRequestPage.js +++ b/src/pages/EditRequestPage.js @@ -30,6 +30,7 @@ import EditRequestCategoryPage from './EditRequestCategoryPage'; import EditRequestTagPage from './EditRequestTagPage'; import categoryPropTypes from '../components/categoryPropTypes'; import ScreenWrapper from '../components/ScreenWrapper'; +import transactionPropTypes from '../components/transactionPropTypes'; const propTypes = { /** Route from navigation */ @@ -75,6 +76,9 @@ const propTypes = { /** Collection of tags attached to a policy */ policyTags: tagPropTypes, + /** The original transaction that is being edited */ + transaction: transactionPropTypes, + ...withCurrentUserPersonalDetailsPropTypes, }; @@ -88,10 +92,12 @@ const defaultProps = { }, policyCategories: {}, policyTags: {}, + transaction: {}, }; function EditRequestPage({betas, report, route, parentReport, policy, session, policyCategories, policyTags, parentReportActions, transaction}) { - const parentReportAction = parentReportActions[report.parentReportActionID]; + const parentReportActionID = lodashGet(report, 'parentReportActionID', '0'); + const parentReportAction = lodashGet(parentReportActions, parentReportActionID); const { amount: transactionAmount, currency: transactionCurrency, @@ -321,7 +327,8 @@ export default compose( withOnyx({ transaction: { key: ({report, parentReportActions}) => { - const parentReportAction = lodashGet(parentReportActions, [report.parentReportActionID]); + const parentReportActionID = lodashGet(report, 'parentReportActionID', '0'); + const parentReportAction = lodashGet(parentReportActions, parentReportActionID); return `${ONYXKEYS.COLLECTION.TRANSACTION}${lodashGet(parentReportAction, 'originalMessage.IOUTransactionID', 0)}`; }, },