Skip to content
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

[CP Staging] Fix missing merchant and date field in invoice confirm page #51083

Merged
merged 3 commits into from
Oct 18, 2024
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
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
Loading