Skip to content

Commit 45c6972

Browse files
committed
Fix issue
1 parent 18bd290 commit 45c6972

4 files changed

Lines changed: 7 additions & 6 deletions

File tree

src/components/MoneyReportHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ function MoneyReportHeader({
844844
}
845845

846846
const currentTransaction = transactions.at(0);
847-
initSplitExpense(currentTransaction, moneyRequestReport?.reportID ?? String(CONST.DEFAULT_NUMBER_ID));
847+
initSplitExpense(currentTransaction);
848848
},
849849
},
850850
[CONST.REPORT.SECONDARY_ACTIONS.CHANGE_WORKSPACE]: {

src/components/MoneyRequestHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ function MoneyRequestHeader({report, parentReportAction, policy, onBackButtonPre
240240
icon: Expensicons.ArrowSplit,
241241
value: CONST.REPORT.SECONDARY_ACTIONS.SPLIT,
242242
onSelected: () => {
243-
initSplitExpense(transaction, reportID ?? String(CONST.DEFAULT_NUMBER_ID));
243+
initSplitExpense(transaction);
244244
},
245245
},
246246
[CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.VIEW_DETAILS]: {

src/libs/actions/IOU.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11661,11 +11661,13 @@ function getSearchOnyxUpdate({
1166111661
/**
1166211662
* Create a draft transaction to set up split expense details for the split expense flow
1166311663
*/
11664-
function initSplitExpense(transaction: OnyxEntry<OnyxTypes.Transaction>, reportID: string, isOpenCreatedSplit?: boolean) {
11664+
function initSplitExpense(transaction: OnyxEntry<OnyxTypes.Transaction>, isOpenCreatedSplit?: boolean) {
1166511665
if (!transaction) {
1166611666
return;
1166711667
}
1166811668

11669+
const reportID = transaction?.reportID ?? String(CONST.DEFAULT_NUMBER_ID);
11670+
1166911671
if (isOpenCreatedSplit) {
1167011672
const originalTransactionID = transaction.comment?.originalTransactionID;
1167111673
const originalTransaction = allTransactions[`${ONYXKEYS.COLLECTION.TRANSACTION}${originalTransactionID}`];

tests/actions/IOUTest.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6074,7 +6074,7 @@ describe('actions/IOU', () => {
60746074

60756075
const reportID = '456';
60766076

6077-
initSplitExpense(transaction, reportID);
6077+
initSplitExpense(transaction);
60786078
await waitForBatchedUpdates();
60796079

60806080
const draftTransaction = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${transaction.transactionID}`);
@@ -6100,9 +6100,8 @@ describe('actions/IOU', () => {
61006100
});
61016101
it('should not initialize split expense for null transaction', async () => {
61026102
const transaction: Transaction | undefined = undefined;
6103-
const reportID = '456';
61046103

6105-
initSplitExpense(transaction, reportID);
6104+
initSplitExpense(transaction);
61066105
await waitForBatchedUpdates();
61076106

61086107
expect(transaction).toBeFalsy();

0 commit comments

Comments
 (0)