Skip to content

Commit f9e4ee7

Browse files
authored
Merge pull request #61695 from Expensify/revert-60940-59499-manual-confirmation
[CP Staging] Revert "Fix manual confirmation page shows per diem confirmation page"
2 parents ae3be09 + 9c18db6 commit f9e4ee7

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/pages/iou/request/IOURequestStartPage.tsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,17 @@ function IOURequestStartPage({
7070
const isFromGlobalCreate = isEmptyObject(report?.reportID);
7171
const prevTransactionReportID = usePrevious(transaction?.reportID);
7272

73+
// Clear out the temporary expense if the reportID in the URL has changed from the transaction's reportID.
74+
useFocusEffect(
75+
useCallback(() => {
76+
// The test transaction can change the reportID of the transaction on the flow so we should prevent the reportID from being reverted again.
77+
if (transaction?.reportID === reportID || isLoadingSelectedTab || prevTransactionReportID !== transaction?.reportID) {
78+
return;
79+
}
80+
initMoneyRequest(reportID, policy, isFromGlobalCreate, transaction?.iouRequestType, transactionRequestType);
81+
}, [transaction, policy, reportID, isFromGlobalCreate, transactionRequestType, isLoadingSelectedTab, prevTransactionReportID]),
82+
);
83+
7384
useEffect(() => {
7485
Performance.markEnd(CONST.TIMING.OPEN_CREATE_EXPENSE);
7586
}, []);
@@ -88,16 +99,6 @@ function IOURequestStartPage({
8899
[policy, reportID, isFromGlobalCreate, transaction],
89100
);
90101

91-
useFocusEffect(
92-
useCallback(() => {
93-
// The test transaction can change the reportID of the transaction on the flow so we should prevent the reportID from being reverted again.
94-
if (isLoadingSelectedTab || prevTransactionReportID !== transaction?.reportID) {
95-
return;
96-
}
97-
resetIOUTypeIfChanged(transactionRequestType);
98-
}, [transaction?.reportID, resetIOUTypeIfChanged, transactionRequestType, isLoadingSelectedTab, prevTransactionReportID]),
99-
);
100-
101102
const [headerWithBackBtnContainerElement, setHeaderWithBackButtonContainerElement] = useState<HTMLElement | null>(null);
102103
const [tabBarContainerElement, setTabBarContainerElement] = useState<HTMLElement | null>(null);
103104
const [activeTabContainerElement, setActiveTabContainerElement] = useState<HTMLElement | null>(null);

0 commit comments

Comments
 (0)