From 9c18db6661842d10c3658cfe0c1f7e6193360aca Mon Sep 17 00:00:00 2001 From: Mohammad Luthfi Fathur Rahman Date: Thu, 8 May 2025 21:00:37 +0700 Subject: [PATCH] Revert "Fix manual confirmation page shows per diem confirmation page" --- src/pages/iou/request/IOURequestStartPage.tsx | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/pages/iou/request/IOURequestStartPage.tsx b/src/pages/iou/request/IOURequestStartPage.tsx index b45f504e82479..a1c94aac30071 100644 --- a/src/pages/iou/request/IOURequestStartPage.tsx +++ b/src/pages/iou/request/IOURequestStartPage.tsx @@ -70,6 +70,17 @@ function IOURequestStartPage({ const isFromGlobalCreate = isEmptyObject(report?.reportID); const prevTransactionReportID = usePrevious(transaction?.reportID); + // Clear out the temporary expense if the reportID in the URL has changed from the transaction's reportID. + useFocusEffect( + useCallback(() => { + // The test transaction can change the reportID of the transaction on the flow so we should prevent the reportID from being reverted again. + if (transaction?.reportID === reportID || isLoadingSelectedTab || prevTransactionReportID !== transaction?.reportID) { + return; + } + initMoneyRequest(reportID, policy, isFromGlobalCreate, transaction?.iouRequestType, transactionRequestType); + }, [transaction, policy, reportID, isFromGlobalCreate, transactionRequestType, isLoadingSelectedTab, prevTransactionReportID]), + ); + useEffect(() => { Performance.markEnd(CONST.TIMING.OPEN_CREATE_EXPENSE); }, []); @@ -88,16 +99,6 @@ function IOURequestStartPage({ [policy, reportID, isFromGlobalCreate, transaction], ); - useFocusEffect( - useCallback(() => { - // The test transaction can change the reportID of the transaction on the flow so we should prevent the reportID from being reverted again. - if (isLoadingSelectedTab || prevTransactionReportID !== transaction?.reportID) { - return; - } - resetIOUTypeIfChanged(transactionRequestType); - }, [transaction?.reportID, resetIOUTypeIfChanged, transactionRequestType, isLoadingSelectedTab, prevTransactionReportID]), - ); - const [headerWithBackBtnContainerElement, setHeaderWithBackButtonContainerElement] = useState(null); const [tabBarContainerElement, setTabBarContainerElement] = useState(null); const [activeTabContainerElement, setActiveTabContainerElement] = useState(null);