-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix: reverting the amount and currency after error clearance. #55102
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
Changes from 4 commits
bdf6e35
1d71117
04d54df
ca37da6
35bacea
acbd01e
aeff354
21bda1e
4f6aa62
462e71f
a7d8b3f
8b645c1
c28c08a
9488811
f86baaa
72cf04e
a9b9d32
211524c
1b5c26a
85693a0
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 |
---|---|---|
|
@@ -71,9 +71,9 @@ | |
const receiptFieldViolationNames: OnyxTypes.ViolationName[] = [CONST.VIOLATIONS.MODIFIED_AMOUNT, CONST.VIOLATIONS.MODIFIED_DATE]; | ||
|
||
const getTransactionID = (report: OnyxEntry<OnyxTypes.Report>, parentReportActions: OnyxEntry<OnyxTypes.ReportActions>) => { | ||
const parentReportAction = parentReportActions?.[report?.parentReportActionID ?? '-1']; | ||
Check failure on line 74 in src/components/ReportActionItem/MoneyRequestView.tsx
|
||
const originalMessage = parentReportAction && ReportActionsUtils.isMoneyRequestAction(parentReportAction) ? ReportActionsUtils.getOriginalMessage(parentReportAction) : undefined; | ||
return originalMessage?.IOUTransactionID ?? -1; | ||
Check failure on line 76 in src/components/ReportActionItem/MoneyRequestView.tsx
|
||
}; | ||
|
||
function MoneyRequestView({report, shouldShowAnimatedBackground, readonly = false, updatedTransaction, isFromReviewDuplicates = false}: MoneyRequestViewProps) { | ||
|
@@ -81,8 +81,8 @@ | |
const session = useSession(); | ||
const {isOffline} = useNetwork(); | ||
const {translate, toLocaleDigit} = useLocalize(); | ||
const parentReportID = report?.parentReportID ?? '-1'; | ||
Check failure on line 84 in src/components/ReportActionItem/MoneyRequestView.tsx
|
||
const policyID = report?.policyID ?? '-1'; | ||
Check failure on line 85 in src/components/ReportActionItem/MoneyRequestView.tsx
|
||
const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${parentReportID}`); | ||
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${parentReport?.parentReportID}`, { | ||
selector: (chatReportValue) => chatReportValue && {reportID: chatReportValue.reportID, errorFields: chatReportValue.errorFields}, | ||
|
@@ -97,12 +97,12 @@ | |
}); | ||
const [transactionViolations] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${getTransactionID(report, parentReportActions)}`); | ||
|
||
const parentReportAction = parentReportActions?.[report?.parentReportActionID ?? '-1']; | ||
Check failure on line 100 in src/components/ReportActionItem/MoneyRequestView.tsx
|
||
const isTrackExpense = ReportUtils.isTrackExpenseReport(report); | ||
const moneyRequestReport = parentReport; | ||
const linkedTransactionID = useMemo(() => { | ||
const originalMessage = parentReportAction && ReportActionsUtils.isMoneyRequestAction(parentReportAction) ? ReportActionsUtils.getOriginalMessage(parentReportAction) : undefined; | ||
return originalMessage?.IOUTransactionID ?? '-1'; | ||
Check failure on line 105 in src/components/ReportActionItem/MoneyRequestView.tsx
|
||
}, [parentReportAction]); | ||
|
||
const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${linkedTransactionID}`); | ||
|
@@ -227,7 +227,7 @@ | |
if (newBillable === TransactionUtils.getBillable(transaction)) { | ||
return; | ||
} | ||
IOU.updateMoneyRequestBillable(transaction?.transactionID ?? '-1', report?.reportID ?? '-1', newBillable, policy, policyTagList, policyCategories); | ||
Check failure on line 230 in src/components/ReportActionItem/MoneyRequestView.tsx
|
||
}, | ||
[transaction, report, policy, policyTagList, policyCategories], | ||
); | ||
|
@@ -323,8 +323,8 @@ | |
ROUTES.MONEY_REQUEST_STEP_DISTANCE.getRoute( | ||
CONST.IOU.ACTION.EDIT, | ||
iouType, | ||
transaction?.transactionID ?? '-1', | ||
Check failure on line 326 in src/components/ReportActionItem/MoneyRequestView.tsx
|
||
report?.reportID ?? '-1', | ||
Check failure on line 327 in src/components/ReportActionItem/MoneyRequestView.tsx
|
||
Navigation.getReportRHPActiveRoute(), | ||
), | ||
) | ||
|
@@ -469,7 +469,7 @@ | |
return; | ||
} | ||
} | ||
Transaction.clearError(transaction?.transactionID ?? linkedTransactionID); | ||
Transaction.clearError(transaction?.transactionID ?? linkedTransactionID, {}); | ||
ReportActions.clearAllRelatedReportActionErrors(report?.reportID ?? '-1', parentReportAction); | ||
}} | ||
> | ||
|
Uh oh!
There was an error while loading. Please reload this page.