Skip to content

Commit

Permalink
Merge pull request #51083 from bernhardoj/fix/51078-wrong-request-type
Browse files Browse the repository at this point in the history
Fix missing merchant and date field in invoice confirm page

(cherry picked from commit 4d3e707)

(CP triggered by Beamanator)
  • Loading branch information
Beamanator authored and OSBotify committed Oct 18, 2024
1 parent 31708f2 commit 99019b6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/pages/iou/request/IOURequestStartPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ function IOURequestStartPage({
}: IOURequestStartPageProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
const shouldUseTab = iouType !== CONST.IOU.TYPE.SEND && iouType !== CONST.IOU.TYPE.PAY && iouType !== CONST.IOU.TYPE.INVOICE;
const [isDraggingOver, setIsDraggingOver] = useState(false);
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`);
const policy = usePolicy(report?.policyID);
const [selectedTab = CONST.TAB_REQUEST.SCAN, selectedTabResult] = useOnyx(`${ONYXKEYS.COLLECTION.SELECTED_TAB}${CONST.TAB.IOU_REQUEST_TYPE}`);
const isLoadingSelectedTab = isLoadingOnyxValue(selectedTabResult);
const isLoadingSelectedTab = shouldUseTab ? isLoadingOnyxValue(selectedTabResult) : false;
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${route?.params.transactionID || -1}`);
const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY);
Expand All @@ -58,7 +59,10 @@ function IOURequestStartPage({
[CONST.IOU.TYPE.INVOICE]: translate('workspace.invoices.sendInvoice'),
[CONST.IOU.TYPE.CREATE]: translate('iou.createExpense'),
};
const transactionRequestType = useMemo(() => transaction?.iouRequestType ?? selectedTab, [transaction?.iouRequestType, selectedTab]);
const transactionRequestType = useMemo(
() => (transaction?.iouRequestType ?? shouldUseTab ? selectedTab : CONST.IOU.REQUEST_TYPE.MANUAL),
[transaction?.iouRequestType, shouldUseTab, selectedTab],
);
const isFromGlobalCreate = isEmptyObject(report?.reportID);

// Clear out the temporary expense if the reportID in the URL has changed from the transaction's reportID
Expand Down Expand Up @@ -134,7 +138,7 @@ function IOURequestStartPage({
/>
</FocusTrapContainerElement>

{iouType !== CONST.IOU.TYPE.SEND && iouType !== CONST.IOU.TYPE.PAY && iouType !== CONST.IOU.TYPE.INVOICE ? (
{shouldUseTab ? (
<OnyxTabNavigator
id={CONST.TAB.IOU_REQUEST_TYPE}
defaultSelectedTab={CONST.TAB_REQUEST.SCAN}
Expand Down

0 comments on commit 99019b6

Please sign in to comment.