From 2b7f1de4fa5cadf53e87974ae3513b88185b3827 Mon Sep 17 00:00:00 2001 From: Burhan-Rashid Date: Tue, 29 Jul 2025 21:39:32 +0530 Subject: [PATCH] fix: currency not resetting to default currency on page reload while creating a new manual expense --- src/libs/actions/IOU.ts | 2 +- src/pages/iou/request/IOURequestStartPage.tsx | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index c9fbd966312e..5cd75a62e80a 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -258,7 +258,7 @@ type InitMoneyRequestParams = { policy?: OnyxEntry; isFromGlobalCreate?: boolean; currentIouRequestType?: IOURequestType | undefined; - newIouRequestType: IOURequestType; + newIouRequestType: IOURequestType | undefined; report: OnyxEntry; parentReport: OnyxEntry; }; diff --git a/src/pages/iou/request/IOURequestStartPage.tsx b/src/pages/iou/request/IOURequestStartPage.tsx index 446d81583252..3f6f36f68fad 100644 --- a/src/pages/iou/request/IOURequestStartPage.tsx +++ b/src/pages/iou/request/IOURequestStartPage.tsx @@ -115,6 +115,23 @@ function IOURequestStartPage({ Navigation.closeRHPFlow(); }; + // This useEffect is used to initialize the money request, so that currency will be reset to default currency on page reload. + useEffect(() => { + if (transaction?.amount !== 0) { + return; + } + initMoneyRequest({ + reportID, + policy, + isFromGlobalCreate, + currentIouRequestType: transaction?.iouRequestType, + newIouRequestType: transaction?.iouRequestType, + report, + parentReport, + }); + // eslint-disable-next-line + }, []); + const resetIOUTypeIfChanged = useCallback( (newIOUType: IOURequestType) => { if (transaction?.iouRequestType === newIOUType) {