From 50048116f4ca18f71324e4ce9b7c3acc143a4f82 Mon Sep 17 00:00:00 2001 From: Getabalew Date: Tue, 5 Aug 2025 17:12:52 +0300 Subject: [PATCH 1/3] fix: crash when submitting expense to workspace --- src/libs/ReportUtils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 8267312e54e5..fc65757d67c0 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -5172,7 +5172,7 @@ function getReportNameInternal({ if (isMoneyRequestAction(parentReportAction)) { const originalMessage = getOriginalMessage(parentReportAction); const reportPolicy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]; - const last4Digits = reportPolicy?.achAccount?.accountNumber.slice(-4) ?? ''; + const last4Digits = reportPolicy?.achAccount?.accountNumber?.slice(-4) ?? ''; if (originalMessage?.type === CONST.IOU.REPORT_ACTION_TYPE.PAY) { if (originalMessage.paymentType === CONST.IOU.PAYMENT_TYPE.ELSEWHERE) { @@ -9236,7 +9236,7 @@ function getIOUReportActionDisplayMessage(reportAction: OnyxEntry, let translationKey: TranslationPaths; if (originalMessage?.type === CONST.IOU.REPORT_ACTION_TYPE.PAY) { const reportPolicy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]; - const last4Digits = reportPolicy?.achAccount?.accountNumber.slice(-4) ?? ''; + const last4Digits = reportPolicy?.achAccount?.accountNumber?.slice(-4) ?? ''; switch (originalMessage.paymentType) { case CONST.IOU.PAYMENT_TYPE.ELSEWHERE: From 6cfc5deda634ae1787fbc55aec8dbd1af197f57e Mon Sep 17 00:00:00 2001 From: Getabalew Date: Tue, 5 Aug 2025 19:22:09 +0300 Subject: [PATCH 2/3] fix: pass reports to getPolicyExpenseChat --- src/components/KYCWall/BaseKYCWall.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/KYCWall/BaseKYCWall.tsx b/src/components/KYCWall/BaseKYCWall.tsx index f38a0884745e..30b247cf409f 100644 --- a/src/components/KYCWall/BaseKYCWall.tsx +++ b/src/components/KYCWall/BaseKYCWall.tsx @@ -55,6 +55,7 @@ function KYCWall({ const [bankAccountList = getEmptyObject()] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST, {canBeMissing: true}); const [reimbursementAccount] = useOnyx(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {canBeMissing: true}); const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${chatReportID}`, {canBeMissing: true}); + const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: true}); const {formatPhoneNumber} = useLocalize(); @@ -121,7 +122,7 @@ function KYCWall({ } else if (paymentMethod === CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT || policy) { if (iouReport && isIOUReport(iouReport)) { if (policy) { - const policyExpenseChatReportID = getPolicyExpenseChat(iouReport.ownerAccountID, policy.id)?.reportID; + const policyExpenseChatReportID = getPolicyExpenseChat(iouReport.ownerAccountID, policy.id, allReports)?.reportID; if (!policyExpenseChatReportID) { const {policyExpenseChatReportID: newPolicyExpenseChatReportID} = moveIOUReportToPolicyAndInviteSubmitter(iouReport.reportID, policy.id, formatPhoneNumber) ?? {}; savePreferredPaymentMethod(iouReport.policyID, policy.id, CONST.LAST_PAYMENT_METHOD.IOU, lastPaymentMethod?.[policy.id]); From aff8da3e159cdd8cfd42f7ba0c82b1eeab85d0bb Mon Sep 17 00:00:00 2001 From: Getabalew Date: Tue, 5 Aug 2025 19:39:10 +0300 Subject: [PATCH 3/3] fix: lint --- src/components/KYCWall/BaseKYCWall.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/KYCWall/BaseKYCWall.tsx b/src/components/KYCWall/BaseKYCWall.tsx index 30b247cf409f..00d59d2aa11c 100644 --- a/src/components/KYCWall/BaseKYCWall.tsx +++ b/src/components/KYCWall/BaseKYCWall.tsx @@ -158,7 +158,7 @@ function KYCWall({ Navigation.navigate(bankAccountRoute); } }, - [addBankAccountRoute, addDebitCardRoute, chatReport, iouReport, onSelectPaymentMethod, formatPhoneNumber, lastPaymentMethod], + [addBankAccountRoute, addDebitCardRoute, chatReport, iouReport, onSelectPaymentMethod, formatPhoneNumber, lastPaymentMethod, allReports], ); /**