-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Fix/90661 #91326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/90661 #91326
Changes from all commits
39facc2
d6b128c
a1ad59d
73bda69
7759af0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,6 +75,7 @@ import { | |
| } from '@libs/TransactionUtils'; | ||
| import {getIOURequestPolicyID, getMoneyRequestParticipantsFromReport, setMoneyRequestParticipants, setMoneyRequestParticipantsFromReport} from '@userActions/IOU/MoneyRequest'; | ||
| import {setMoneyRequestReceipt} from '@userActions/IOU/Receipt'; | ||
| import {setTransactionReport} from '@userActions/Transaction'; | ||
| import {removeDraftTransaction, replaceDefaultDraftTransaction} from '@userActions/TransactionEdit'; | ||
| import CONST from '@src/CONST'; | ||
| import type {IOUType} from '@src/CONST'; | ||
|
|
@@ -114,6 +115,7 @@ function IOURequestStepConfirmation({ | |
| report: reportReal, | ||
| reportDraft, | ||
| route, | ||
| navigation, | ||
| transaction: initialTransaction, | ||
| isLoadingTransaction, | ||
| shouldHideHeader = false, | ||
|
|
@@ -343,12 +345,28 @@ function IOURequestStepConfirmation({ | |
| if (!activeTransactionID) { | ||
| return; | ||
| } | ||
|
|
||
| const firstParticipant = participantsList.at(0); | ||
| if (isNewManualExpenseFlowEnabled && firstParticipant?.isSelfDM && selfDMReport?.reportID && iouType !== CONST.IOU.TYPE.SPLIT) { | ||
| for (const draftTransaction of transactions) { | ||
| const selfDMParticipants = getMoneyRequestParticipantsFromReport(selfDMReport, currentUserPersonalDetails.accountID).map((participant) => ({ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❌ PERF-13 (docs)
Hoist the const selfDMParticipants = getMoneyRequestParticipantsFromReport(selfDMReport, currentUserPersonalDetails.accountID).map((participant) => ({
...participant,
iouType: CONST.IOU.TYPE.TRACK,
}));
for (const draftTransaction of transactions) {
setMoneyRequestParticipants(draftTransaction.transactionID, selfDMParticipants);
setTransactionReport(draftTransaction.transactionID, {reportID: CONST.REPORT.UNREPORTED_REPORT_ID}, true);
}Reviewed at: 7759af0 | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ChavdaSachin What do you think about this? |
||
| ...participant, | ||
| iouType: CONST.IOU.TYPE.TRACK, | ||
| })); | ||
| setMoneyRequestParticipants(draftTransaction.transactionID, selfDMParticipants); | ||
| setTransactionReport(draftTransaction.transactionID, {reportID: CONST.REPORT.UNREPORTED_REPORT_ID}, true); | ||
| } | ||
| Navigation.setParams({iouType: CONST.IOU.TYPE.TRACK, reportID: selfDMReport.reportID}, route.key, navigation.getState()?.key); | ||
| closeParticipantPicker(); | ||
| return; | ||
| } | ||
|
|
||
| setMoneyRequestParticipants(activeTransactionID, participantsList); | ||
| if (participantsList.length > 0) { | ||
| closeParticipantPicker(); | ||
| } | ||
| }, | ||
| [activeTransactionID, closeParticipantPicker], | ||
| [activeTransactionID, closeParticipantPicker, currentUserPersonalDetails.accountID, isNewManualExpenseFlowEnabled, iouType, navigation, route.key, selfDMReport, transactions], | ||
| ); | ||
|
|
||
| useEffect(() => { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When
NEW_MANUAL_EXPENSE_FLOWis enabled and the amount input is still untouched (transaction.isAmountSetis false), this new guard now returnscommon.error.invalidAmountforINVOICE,PAY, andSPLITbecauseiouAmountdefaults to0. That bypasses the intended required-field path immediately below and shows the wrong validation state for an empty field. This regression is introduced by broadening the invalid-amount check at this point in the flow; theisAmountSetcheck should run first (or be folded into this condition) so empty amounts still surfacecommon.error.fieldRequiredin manual-expense confirmation.Useful? React with 👍 / 👎.