From e0167e62d7299c56110aeac4e6154e4f29d3e788 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Thu, 1 Jan 2026 17:35:33 +0300 Subject: [PATCH] fix - Confirm page loads infinitely after opening scan shortcut and opening create manual from QAB --- src/pages/iou/request/IOURequestStartPage.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pages/iou/request/IOURequestStartPage.tsx b/src/pages/iou/request/IOURequestStartPage.tsx index 7f63c18c3699..03808e99e1cb 100644 --- a/src/pages/iou/request/IOURequestStartPage.tsx +++ b/src/pages/iou/request/IOURequestStartPage.tsx @@ -72,7 +72,8 @@ function IOURequestStartPage({ const policy = usePolicy(report?.policyID); const [selectedTab, selectedTabResult] = useOnyx(`${ONYXKEYS.COLLECTION.SELECTED_TAB}${CONST.TAB.IOU_REQUEST_TYPE}`, {canBeMissing: true}); const isLoadingSelectedTab = shouldUseTab ? isLoadingOnyxValue(selectedTabResult) : false; - const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${getNonEmptyStringOnyxID(route?.params.transactionID)}`, {canBeMissing: true}); + const [transaction, transactionResult] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${getNonEmptyStringOnyxID(route?.params.transactionID)}`, {canBeMissing: true}); + const isLoadingTransaction = isLoadingOnyxValue(transactionResult); const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: false}); const [lastSelectedDistanceRates] = useOnyx(ONYXKEYS.NVP_LAST_SELECTED_DISTANCE_RATES, {canBeMissing: true}); const [optimisticTransactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_DRAFT, { @@ -181,11 +182,11 @@ function IOURequestStartPage({ 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 || !transactionRequestType || prevTransactionReportID !== transaction?.reportID) { + if (transaction?.reportID === reportID || isLoadingTransaction || isLoadingSelectedTab || !transactionRequestType || prevTransactionReportID !== transaction?.reportID) { return; } resetIOUTypeIfChanged(transactionRequestType); - }, [transaction?.reportID, reportID, resetIOUTypeIfChanged, transactionRequestType, isLoadingSelectedTab, prevTransactionReportID]), + }, [transaction?.reportID, reportID, resetIOUTypeIfChanged, transactionRequestType, isLoadingSelectedTab, prevTransactionReportID, isLoadingTransaction]), ); const [headerWithBackBtnContainerElement, setHeaderWithBackButtonContainerElement] = useState(null);