Skip to content

Commit

Permalink
fix freeze related to iou start
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgrzybowski committed Feb 11, 2025
1 parent f134b1c commit 9a5140d
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/pages/iou/request/IOURequestStartPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, {useCallback, useEffect, useMemo, useState} from 'react';
import {useFocusEffect} from '@react-navigation/native';
import React, {useCallback, useMemo, useState} from 'react';
import {View} from 'react-native';
import {useOnyx} from 'react-native-onyx';
import DragAndDropProvider from '@components/DragAndDrop/Provider';
Expand Down Expand Up @@ -70,13 +71,15 @@ function IOURequestStartPage({
);
const isFromGlobalCreate = isEmptyObject(report?.reportID);

// Clear out the temporary expense if the reportID in the URL has changed from the transaction's reportID
useEffect(() => {
if (transaction?.reportID === reportID || isLoadingSelectedTab) {
return;
}
initMoneyRequest(reportID, policy, isFromGlobalCreate, transaction?.iouRequestType, transactionRequestType);
}, [transaction, policy, reportID, iouType, isFromGlobalCreate, transactionRequestType, isLoadingSelectedTab]);
// Clear out the temporary expense if the reportID in the URL has changed from the transaction's reportID.
useFocusEffect(
useCallback(() => {
if (transaction?.reportID === reportID || isLoadingSelectedTab) {
return;
}
initMoneyRequest(reportID, policy, isFromGlobalCreate, transaction?.iouRequestType, transactionRequestType);
}, [transaction, policy, reportID, isFromGlobalCreate, transactionRequestType, isLoadingSelectedTab]),
);

const navigateBack = () => {
Navigation.closeRHPFlow();
Expand Down

0 comments on commit 9a5140d

Please sign in to comment.