Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 6 additions & 31 deletions src/components/ReportActionItem/MoneyRequestView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import MenuItem from '@components/MenuItem';
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
import {usePolicyCategories, usePolicyTags} from '@components/OnyxListItemProvider';
import ReportActionsSkeletonView from '@components/ReportActionsSkeletonView';
import Switch from '@components/Switch';
import Text from '@components/Text';
import ViolationMessages from '@components/ViolationMessages';
Expand Down Expand Up @@ -487,9 +488,6 @@ function MoneyRequestView({
</>
);

// Whether to show receipt audit result (e.g.`Verified`, `Issue Found`) and messages (e.g. `Receipt not verified. Please confirm accuracy.`)
// `!!(receiptViolations.length || didReceiptScanSucceed)` is for not showing `Verified` when `receiptViolations` is empty and `didReceiptScanSucceed` is false.

const hasDependentTags = hasDependentTagsPolicyUtils(policy, policyTagList);

const previousTransactionTag = usePrevious(transactionTag);
Expand Down Expand Up @@ -569,6 +567,10 @@ function MoneyRequestView({
const actualParentReport = isFromMergeTransaction ? getReportOrDraftReport(getReportIDForExpense(updatedTransaction)) : parentReport;
const shouldShowReport = !!parentReportID || !!actualParentReport;

if (!report?.reportID || !transaction?.transactionID) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coming from #79072. transaction can be undefined for a self-DM expense opened whilst offline. So this condition would lead to displaying an infinite loader rather than displaying the cached data.

return <ReportActionsSkeletonView />;
}

return (
<View style={styles.pRelative}>
{shouldShowAnimatedBackground && <AnimatedEmptyStateBackground />}
Expand Down Expand Up @@ -607,9 +609,6 @@ function MoneyRequestView({
interactive={canEditAmount}
shouldShowRightIcon={canEditAmount}
onPress={() => {
if (!transaction?.transactionID || !report?.reportID) {
return;
}
Navigation.navigate(
ROUTES.MONEY_REQUEST_STEP_AMOUNT.getRoute(CONST.IOU.ACTION.EDIT, iouType, transaction.transactionID, report.reportID, '', '', getReportRHPActiveRoute()),
);
Expand All @@ -627,9 +626,6 @@ function MoneyRequestView({
shouldShowRightIcon={canEdit}
titleStyle={styles.flex1}
onPress={() => {
if (!transaction?.transactionID || !report?.reportID) {
return;
}
Navigation.navigate(
ROUTES.MONEY_REQUEST_STEP_DESCRIPTION.getRoute(CONST.IOU.ACTION.EDIT, iouType, transaction.transactionID, report.reportID, getReportRHPActiveRoute()),
);
Expand All @@ -651,9 +647,6 @@ function MoneyRequestView({
shouldShowRightIcon={canEditMerchant}
titleStyle={styles.flex1}
onPress={() => {
if (!transaction?.transactionID || !report?.reportID) {
return;
}
Navigation.navigate(
ROUTES.MONEY_REQUEST_STEP_MERCHANT.getRoute(CONST.IOU.ACTION.EDIT, iouType, transaction.transactionID, report.reportID, getReportRHPActiveRoute()),
);
Expand All @@ -674,9 +667,6 @@ function MoneyRequestView({
shouldShowRightIcon={canEditDate}
titleStyle={styles.flex1}
onPress={() => {
if (!transaction?.transactionID || !report?.reportID) {
return;
}
Navigation.navigate(
ROUTES.MONEY_REQUEST_STEP_DATE.getRoute(CONST.IOU.ACTION.EDIT, iouType, transaction.transactionID, report.reportID, getReportRHPActiveRoute()),
);
Expand All @@ -696,9 +686,6 @@ function MoneyRequestView({
shouldShowRightIcon={canEdit}
titleStyle={styles.flex1}
onPress={() => {
if (!transaction?.transactionID || !report?.reportID) {
return;
}
if (!policy) {
Navigation.navigate(
ROUTES.MONEY_REQUEST_UPGRADE.getRoute({
Expand Down Expand Up @@ -741,9 +728,6 @@ function MoneyRequestView({
shouldShowRightIcon={canEditTaxFields}
titleStyle={styles.flex1}
onPress={() => {
if (!transaction?.transactionID || !report?.reportID) {
return;
}
Navigation.navigate(
ROUTES.MONEY_REQUEST_STEP_TAX_RATE.getRoute(CONST.IOU.ACTION.EDIT, iouType, transaction.transactionID, report.reportID, getReportRHPActiveRoute()),
);
Expand All @@ -762,9 +746,6 @@ function MoneyRequestView({
shouldShowRightIcon={canEditTaxFields}
titleStyle={styles.flex1}
onPress={() => {
if (!transaction?.transactionID || !report?.reportID) {
return;
}
Navigation.navigate(
ROUTES.MONEY_REQUEST_STEP_TAX_AMOUNT.getRoute(CONST.IOU.ACTION.EDIT, iouType, transaction.transactionID, report.reportID, getReportRHPActiveRoute()),
);
Expand All @@ -785,9 +766,6 @@ function MoneyRequestView({
style={[styles.moneyRequestMenuItem]}
titleStyle={styles.flex1}
onPress={() => {
if (!transaction?.transactionID || !report?.reportID) {
return;
}
Navigation.navigate(ROUTES.MONEY_REQUEST_ATTENDEE.getRoute(CONST.IOU.ACTION.EDIT, iouType, transaction.transactionID, report.reportID));
}}
interactive={canEdit}
Expand Down Expand Up @@ -846,7 +824,7 @@ function MoneyRequestView({
style={[styles.moneyRequestMenuItem]}
titleStyle={styles.flex1}
onPress={() => {
if (!canEditReport || !report?.reportID || !transaction?.transactionID) {
if (!canEditReport) {
return;
}
Navigation.navigate(
Expand All @@ -864,9 +842,6 @@ function MoneyRequestView({
title={translate('travel.viewTripDetails')}
icon={Expensicons.Suitcase}
onPress={() => {
if (!transaction?.transactionID || !report?.reportID) {
return;
}
const reservations = transaction?.receipt?.reservationList?.length ?? 0;
if (reservations > 1) {
Navigation.navigate(ROUTES.TRAVEL_TRIP_SUMMARY.getRoute(report.reportID, transaction.transactionID, getReportRHPActiveRoute()));
Expand Down
Loading