From c1db378e92c4de0f9c07ccfaeaf374341fe5eaa0 Mon Sep 17 00:00:00 2001 From: nkdengineer <161821005+nkdengineer@users.noreply.github.com> Date: Wed, 17 Dec 2025 12:00:05 +0700 Subject: [PATCH 1/6] Revert "[CP Staging] Revert "fix: Add receipt from manual expense, QAB is scan receipt but confirm detail display as manual"" --- src/pages/iou/request/IOURequestStartPage.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/pages/iou/request/IOURequestStartPage.tsx b/src/pages/iou/request/IOURequestStartPage.tsx index 60d0e218540f0..0d501165f6ffc 100644 --- a/src/pages/iou/request/IOURequestStartPage.tsx +++ b/src/pages/iou/request/IOURequestStartPage.tsx @@ -69,7 +69,9 @@ function IOURequestStartPage({ const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {canBeMissing: true}); const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`, {canBeMissing: true}); const policy = usePolicy(report?.policyID); - const [selectedTab, selectedTabResult] = useOnyx(`${ONYXKEYS.COLLECTION.SELECTED_TAB}${CONST.TAB.IOU_REQUEST_TYPE}`, {canBeMissing: true}); + const [lastSelectedTab, selectedTabResult] = useOnyx(`${ONYXKEYS.COLLECTION.SELECTED_TAB}${CONST.TAB.IOU_REQUEST_TYPE}`, {canBeMissing: true}); + const [selectedTab, setSelectedTab] = useState(lastSelectedTab); + const isLoadingSelectedTab = shouldUseTab ? isLoadingOnyxValue(selectedTabResult) : false; const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${getNonEmptyStringOnyxID(route?.params.transactionID)}`, {canBeMissing: true}); const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: false}); @@ -195,6 +197,14 @@ function IOURequestStartPage({ ], ); + const onTabSelected = useCallback( + (newIouType: IOURequestType) => { + setSelectedTab(newIouType); + resetIOUTypeIfChanged(newIouType); + }, + [resetIOUTypeIfChanged], + ); + // Clear out the temporary expense if the reportID in the URL has changed from the transaction's reportID. useFocusEffect( useCallback(() => { @@ -275,7 +285,7 @@ function IOURequestStartPage({ Date: Sun, 21 Dec 2025 22:37:09 +0700 Subject: [PATCH 2/6] fix transaction is undefined --- src/pages/iou/request/IOURequestStartPage.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/pages/iou/request/IOURequestStartPage.tsx b/src/pages/iou/request/IOURequestStartPage.tsx index 684590bced542..4695ac2822c13 100644 --- a/src/pages/iou/request/IOURequestStartPage.tsx +++ b/src/pages/iou/request/IOURequestStartPage.tsx @@ -135,6 +135,13 @@ function IOURequestStartPage({ Performance.markEnd(CONST.TIMING.OPEN_CREATE_EXPENSE); }, []); + useEffect(() => { + if (isLoadingSelectedTab || selectedTab) { + return; + } + setSelectedTab(lastSelectedTab); + }, [isLoadingSelectedTab, selectedTab]); + const navigateBack = () => { Navigation.closeRHPFlow(); }; @@ -249,6 +256,7 @@ function IOURequestStartPage({ useHandleBackButton(onBackButtonPress); + console.log(transaction, isLoadingSelectedTab, lastSelectedTab); return ( Date: Sun, 21 Dec 2025 22:41:00 +0700 Subject: [PATCH 3/6] disable dependency rule --- src/pages/iou/request/IOURequestStartPage.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/iou/request/IOURequestStartPage.tsx b/src/pages/iou/request/IOURequestStartPage.tsx index 4695ac2822c13..71ccd5c7ca470 100644 --- a/src/pages/iou/request/IOURequestStartPage.tsx +++ b/src/pages/iou/request/IOURequestStartPage.tsx @@ -140,6 +140,8 @@ function IOURequestStartPage({ return; } setSelectedTab(lastSelectedTab); + // eslint-disable-next-line react-compiler/react-compiler + // eslint-disable-next-line react-hooks/exhaustive-deps }, [isLoadingSelectedTab, selectedTab]); const navigateBack = () => { From 9ba9bec4adacd7dea140db487ebfd983d099db07 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Sun, 21 Dec 2025 22:43:11 +0700 Subject: [PATCH 4/6] remove log --- src/pages/iou/request/IOURequestStartPage.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/iou/request/IOURequestStartPage.tsx b/src/pages/iou/request/IOURequestStartPage.tsx index 71ccd5c7ca470..208874c88db30 100644 --- a/src/pages/iou/request/IOURequestStartPage.tsx +++ b/src/pages/iou/request/IOURequestStartPage.tsx @@ -258,7 +258,6 @@ function IOURequestStartPage({ useHandleBackButton(onBackButtonPress); - console.log(transaction, isLoadingSelectedTab, lastSelectedTab); return ( Date: Fri, 9 Jan 2026 12:48:37 +0700 Subject: [PATCH 5/6] add comment --- src/pages/iou/request/IOURequestStartPage.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/iou/request/IOURequestStartPage.tsx b/src/pages/iou/request/IOURequestStartPage.tsx index 30cebb2c8baeb..76c0956920359 100644 --- a/src/pages/iou/request/IOURequestStartPage.tsx +++ b/src/pages/iou/request/IOURequestStartPage.tsx @@ -142,6 +142,7 @@ function IOURequestStartPage({ return; } setSelectedTab(lastSelectedTab); + // We only want to set the selected tab when selectedTab is not set yet // eslint-disable-next-line react-compiler/react-compiler // eslint-disable-next-line react-hooks/exhaustive-deps }, [isLoadingSelectedTab, selectedTab]); From a6110e6f233d168942b9f1f1923d245eddddd8a9 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Fri, 9 Jan 2026 17:32:53 +0700 Subject: [PATCH 6/6] update comment --- src/pages/iou/request/IOURequestStartPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/request/IOURequestStartPage.tsx b/src/pages/iou/request/IOURequestStartPage.tsx index 76c0956920359..755cc80921283 100644 --- a/src/pages/iou/request/IOURequestStartPage.tsx +++ b/src/pages/iou/request/IOURequestStartPage.tsx @@ -142,7 +142,7 @@ function IOURequestStartPage({ return; } setSelectedTab(lastSelectedTab); - // We only want to set the selected tab when selectedTab is not set yet + // We only want to set the selected tab when selectedTab is not set yet, don't want to run this effect again when lastSelectedTab changes // eslint-disable-next-line react-compiler/react-compiler // eslint-disable-next-line react-hooks/exhaustive-deps }, [isLoadingSelectedTab, selectedTab]);