Skip to content

Commit 6cfc5de

Browse files
committed
fix: pass reports to getPolicyExpenseChat
1 parent 5004811 commit 6cfc5de

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/components/KYCWall/BaseKYCWall.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ function KYCWall({
5555
const [bankAccountList = getEmptyObject<BankAccountList>()] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST, {canBeMissing: true});
5656
const [reimbursementAccount] = useOnyx(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {canBeMissing: true});
5757
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${chatReportID}`, {canBeMissing: true});
58+
const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: true});
5859

5960
const {formatPhoneNumber} = useLocalize();
6061

@@ -121,7 +122,7 @@ function KYCWall({
121122
} else if (paymentMethod === CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT || policy) {
122123
if (iouReport && isIOUReport(iouReport)) {
123124
if (policy) {
124-
const policyExpenseChatReportID = getPolicyExpenseChat(iouReport.ownerAccountID, policy.id)?.reportID;
125+
const policyExpenseChatReportID = getPolicyExpenseChat(iouReport.ownerAccountID, policy.id, allReports)?.reportID;
125126
if (!policyExpenseChatReportID) {
126127
const {policyExpenseChatReportID: newPolicyExpenseChatReportID} = moveIOUReportToPolicyAndInviteSubmitter(iouReport.reportID, policy.id, formatPhoneNumber) ?? {};
127128
savePreferredPaymentMethod(iouReport.policyID, policy.id, CONST.LAST_PAYMENT_METHOD.IOU, lastPaymentMethod?.[policy.id]);

0 commit comments

Comments
 (0)