You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$175] Expense-Currency and amount does not reset after refresh #104703
Version Number: v9.5.16-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack:https://github.com/Expensify/Expensify/issues/536581 Email or phone of affected tester (no customers): - Issue reported by: Applause Internal Team Bug source: Regression TC Execution Device used: Xiaomi Redmi Note 10S - Android 13
Action Performed:
1.Open New Expensify.
2.Tap FAB - Create expense.
3.Select a non-default currency and enter an amount.
4.Refresh the page
Expected Result:
Currency must be reset to the default currency and the amount must be reset to 0.
Actual Result:
Currency does not reset to the default currency and the amount is not reset to 0.
The Manual tab now saves the amount and currency to the draft transaction in Onyx on every keystroke and currency pick. Onyx keeps that draft across a page reload, and nothing on reload clears it.
AmountField.tsx:262-316: updateCurrency and handleAmountChange call setMoneyRequestCurrency / setMoneyRequestAmount, which merge into transactionsDraft_<id>.
useResetIOUType.ts:159-178: the only reset-on-focus check returns early when the draft's reportID matches the URL's reportID. That is always true after a plain refresh.
This became the default with feat: remove isNewManualExpenseFlowEnabled beta flag, merged 2026-09-09. It made the embedded confirmation form the Manual tab for everyone (IOURequestStartPage.tsx:244). Before that, the Manual tab used IOURequestStepAmount, which kept the amount and currency in local React state until you pressed Next. A refresh threw them away, which is what the regression test still expects.
What changes do you think we should make in order to solve the problem?
First, product needs to decide whether this is a bug. The new flow saves the draft on purpose. Date, Description, and Merchant also survive a refresh. If that is intended, update the regression test instead of the code.
If the draft should reset on refresh:
In useResetIOUType (or IOURequestStartPage), detect the first mount after a fresh app load. A module-level flag that is unset in the current JS session works for this.
On that first mount, if the draft is a global-create MANUAL draft, call initMoneyRequest to rebuild it with amount 0 and the default currency.
Skip this on in-session remounts, such as returning from the participant or category pickers, so real input is not wiped.
What alternative solutions did you explore? (Optional)
Keep AmountField's amount and currency in local state until submit. This restores the old behavior, but the embedded form reads the draft for validation and split shares, so the change is much larger.
Investigation details
The inline-save behavior came from Feat: Manual expense flow UI refactor - r3 (merged 2026-05-13), behind the newManualExpenseFlow beta. Removing the beta exposed it to all users.
setMoneyRequestAmount and setMoneyRequestCurrency merge into ONYXKEYS.COLLECTION.TRANSACTION_DRAFT (MoneyRequest.ts:960-1015). That key is persisted, so it comes back after a reload.
resetIOUTypeIfChanged also returns early when the request type is unchanged (useResetIOUType.ts:100), so reselecting the Manual tab does not reset it either.
Web test: I set EUR and 25 on the Manual tab, but the test tool could not reload the browser. The post-refresh state comes from the code trace, not a live repro.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/104703) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
changed the title [-]Expense-Currency and amount does not reset after refresh[/-][+][$175] Expense-Currency and amount does not reset after refresh[/+]on Oct 22, 2026
There's a file called AmountField.tsx. Every time you type a number or pick a currency, it runs a small function that writes that value into the draft (a scratchpad saved to disk, not just memory). So the moment you type "500" and pick "EUR", it's already saved, permanently, until something explicitly clears it.
Why a refresh doesn't clear it
Another file, useResetIOUType.ts, is supposed to clear old data when needed. But it only clears things when you switch tabs (like going from Manual entry to Scan). It checks "has the thing I'm looking at changed?" On a plain refresh, nothing changed, you're looking at the exact same page. So it sees "nothing changed" and does nothing. It was written to handle switching tabs, not refreshing the page, so it was never going to catch this case.
What changes do you think we should make in order to solve the problem?
Confirm with product first: Date, Description, and Merchant also persist through a refresh today, so if that's intentional, only amount and currency need fixing, not the whole draft.
Where to fix it
A third file, IOURequestStartPage.tsx, runs once when the page first loads (not on every tab switch). Add a check there: "is this the very first time this page loaded since the browser opened it?" If yes, and the user is on the Manual tab starting a brand new expense, wipe just the amount and currency back to empty/default. Leave everything else alone.
The functions to clear the amount and reset the currency already exist (clearMoneyRequestAmount and setMoneyRequestCurrency), they're the same functions that save your typing in the first place. The fix is just calling them once, at the right moment, instead of never.
at module scope:
hasResetManualDraftThisSession = false # resets itself on a real page reload
on IOURequestStartPage mount:
if hasResetManualDraftThisSession: return
hasResetManualDraftThisSession = true
if NOT isFromGlobalCreate OR tab != MANUAL: return
clearDraftAmount(transactionID)
setDraftCurrency(transactionID, defaultCurrency)
What alternative solutions did you explore? (Optional)
Keep amount/currency in local state in AmountField instead of the draft, like the old flow did. Dropped this since the confirmation form reads the draft directly for validation and split shares, so it's a much bigger change for the same result.
Please re-state the problem that we are trying to solve in this issue.
On the global-create Manual tab (FAB → Create expense), the user picks a non-default currency and enters an amount, then reloads the page. After the reload the currency and amount are still there. The regression test expects the currency to go back to the default and the amount to go back to 0, as it did before the new manual flow.
What is the root cause of that problem?
With the new manual expense flow, AmountField (embedded in MoneyRequestConfirmationList) writes the amount and currency straight into the persisted transactionsDraft_<id> Onyx key. It does this on every keystroke and currency pick, via setMoneyRequestAmount / setMoneyRequestCurrency. The old IOURequestStepAmount kept both in local useState until "Next", so a reload discarded them.
Nothing resets the draft on reload. The only reset-on-focus logic is in useResetIOUType, and it returns early when the draft's reportID equals the URL's reportID or when the request type is unchanged. After a plain refresh both conditions are true, so the persisted draft is reused unchanged.
The behavior reached everyone when the isNewManualExpenseFlowEnabled beta was removed. That is why it now shows up in regression testing.
The existing proposals (MelvinBot's and romitg2's) find the same cause, and I agree with both. Neither commits to a fix, and neither covers the Onyx hydration timing or leftover split shares (see the changes below). The issue's Expected Result is explicit, so I am treating this as a bug and not deferring to a product decision.
What changes do you think we should make in order to solve the problem?
Reset only the amount and currency, once per JS session, on the first mount of the Manual tab opened from global create. A real browser reload re-evaluates the module, so the flag starts false again. In-app remounts, such as coming back from the participant, category or tag pickers, keep the flag true and never wipe real input.
Do not call initMoneyRequest. It rebuilds the whole draft and would also wipe Date, Description, Merchant and participants, which the issue does not ask for.
1. A small hook, e.g. src/hooks/useResetManualDraftOnReload.ts
// Module scope: false again after every real page load, stays true across in-app remounts.lethasHandledInitialManualMount=false;functionuseResetManualDraftOnReload({transactionID, isFromGlobalCreate, iouType, isManualTab, defaultCurrency}: Params){const[draft,draftMetadata]=useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`);useEffect(()=>{if(hasHandledInitialManualMount){return;}// Wait until Onyx has hydrated the persisted draft, otherwise we would decide on `undefined`// and burn the one-shot flag.if(draftMetadata.status==='loading'){return;}hasHandledInitialManualMount=true;if(!isFromGlobalCreate||!isManualTab||!draft){return;// leave Scan / Distance / Per diem / edit flows untouched}if(!draft.amount&&draft.currency===defaultCurrency){return;// nothing to reset}// setMoneyRequestAmount(transactionID, amount, currency) merges both atomicallysetMoneyRequestAmount(transactionID,0,defaultCurrency);// Per-participant split amounts derived from the old total would be inconsistent with amount 0if(draft.splitShares){setDraftSplitTransaction/clearsplitSharesforthistransaction}},[draft,draftMetadata.status/* ...other deps */]);}
2. Call the hook from IOURequestStartPage.tsx
Call it next to the existing mount effect.
Pass isFromGlobalCreate, whether the selected tab is CONST.TAB_REQUEST.MANUAL, and the transaction ID.
Compute defaultCurrency the same way initMoneyRequest does for a new draft: the policy's outputCurrency when the report is a workspace one, otherwise currentUserPersonalDetails.localCurrencyCode, falling back to CONST.CURRENCY.USD. Extract that into a shared helper if it is not already one, so the reset value always matches a brand-new draft.
3. Test isolation
Export a test-only reset for the flag, or use jest.isolateModules, so unit tests can simulate a "fresh page load".
What alternative solutions did you explore? (Optional)
Keep amount and currency in local state in AmountField until submit. This mirrors the old behavior, but the embedded confirmation form reads the draft for validation and split-share calculations. It is a much larger refactor for the same outcome.
Call initMoneyRequest on first mount. It is simple, but it wipes Date, Description, Merchant and participants, which are intentionally persisted.
Relax the reportID early return in useResetIOUType. This would also reset the draft on legitimate in-session remounts, such as returning from a picker, and lose the user's input.
Clear drafts globally on app start. This would break other flows that rely on draft persistence, such as the edit and split drafts.
Testing
Manual (web and Android mWeb Chrome):
Tap FAB → Create expense and stay on the Manual tab.
Select a non-default currency (e.g. EUR) and enter an amount (e.g. 25).
Reload the page. The currency should be the default and the amount 0.
Repeat, but fill in Description and Merchant before reloading. Those values should still be there.
Without reloading, enter an amount, open the participant or category picker and go back. The amount and currency should be preserved.
Reload on the Scan, Distance and Per diem tabs and when editing an existing expense. No reset should happen.
Reload with a workspace-report context and confirm the default currency is the workspace's currency.
Unit tests:
Seed transactionsDraft_<id> with a non-default currency and a non-zero amount, then mount IOURequestStartPage or the hook for the first time. Assert that amount is 0 and currency is the default.
Unmount and remount in the same module instance. Assert the draft is untouched.
Mount with the draft not yet hydrated, then hydrate it. Assert the reset still runs once.
Assert that no reset happens when the flow is not global create or the tab is not Manual.
Please re-state the problem that we are trying to solve in this issue.
On the global-create Manual tab (FAB - Create expense), picking a non-default currency and entering an amount, then refreshing the page, keeps the stale currency and amount. Expected: currency resets to default and amount resets to 0 after a refresh.
What is the root cause of that problem?
Since PR #100215 removed the isNewManualExpenseFlowEnabled beta flag, the Manual tab is the embedded confirmation form (IOURequestStartPage). In AmountField.tsx, updateCurrency and handleAmountChange call setMoneyRequestCurrency / setMoneyRequestAmount, which merge into the persisted TRANSACTION_DRAFT Onyx key on every keystroke and currency pick, so the draft survives a reload.
On reload, nothing clears it: useResetIOUType's focus effect is the only reset path, and it returns early when the draft's reportID matches the URL's reportID (src/hooks/useResetIOUType.ts, the useFocusEffect early-return block) - which is always true after a plain refresh. Before the beta removal, the Manual tab kept amount/currency in local React state, so a refresh threw them away; that is what the regression test still expects.
What changes do you think we should make in order to solve the problem?
Detect a fresh app load (a module-level flag in IOURequestStartPage that is false only on the first mount of the JS session).
On that first mount, if the entry point is the global-create MANUAL flow and a persisted draft exists, call initMoneyRequest to rebuild the draft with amount 0 and the default currency.
Skip this on in-session remounts (returning from the participant/category pickers), so live input is never wiped; also leave report-scoped deep-link drafts untouched.
What alternative solutions did you explore?
Keeping AmountField's amount and currency in local state until submit restores the old behavior, but the embedded form reads the draft for validation and split shares, so that change is much larger and riskier.
I will verify: the exact repro steps from the issue on web and mWeb Chrome (non-default currency + amount, refresh - default currency and 0 restored), plus in-session navigation checks (open a picker and back - draft input preserved), and the existing IOU request tests still pass.
Please re-state the problem that we are trying to solve in this issue.
When creating an expense from the global create menu (FAB → Create expense → Manual tab), selecting a non-default currency and entering an amount, and then refreshing the browser page, the currency and amount remain populated instead of resetting to the default currency and 0.
What is the root cause of that problem?
Since PR #100215 removed the isNewManualExpenseFlowEnabled beta flag, IOURequestStartPage embeds IOURequestStepConfirmationContent directly as the Manual tab (src/pages/iou/request/IOURequestStartPage.tsx:246-294) for all standard create/submit/track/split flows instead of IOURequestStepAmount.
Whereas IOURequestStepAmount kept the typed amount and selected currency in local React useState until the user pressed Next, the embedded confirmation form's AmountField (src/components/MoneyRequestConfirmationList/sections/AmountField.tsx:257-319) calls setMoneyRequestCurrency and setMoneyRequestAmount on every currency selection and keystroke, persisting amount, isAmountSet: true, and currency directly into ONYXKEYS.COLLECTION.TRANSACTION_DRAFT (transactionsDraft_1).
On a browser refresh of the start page (/create/expense/...), Onyx rehydrates transactionsDraft_1 from persistent storage, and useResetIOUType (src/hooks/useResetIOUType.ts:101-180) never resets it for two reasons:
In useFocusEffect (lines 169-178), prevTransactionReportID !== transaction?.reportID is false once transaction finishes loading (prevTransactionReportID === transaction?.reportID), or transaction?.reportID === reportID is true, so useFocusEffect returns early.
Even if resetIOUTypeIfChanged(transactionRequestType) were called, transactionRequestType is derived from transaction.iouRequestType (IOURequestStartPage.tsx:164-167), so if (transaction?.iouRequestType === newIOUType) { return; } at useResetIOUType.ts:102-104 immediately short-circuits.
What changes do you think we should make in order to solve the problem?
First, note that because the Manual tab on IOURequestStartPage is now the embedded confirmation form (PR #100215), all fields entered on the Manual tab (Amount, Currency, Merchant, Description, Category, Date) are stored in ONYXKEYS.COLLECTION.TRANSACTION_DRAFT. If product intends for the embedded Manual tab draft to persist across a browser refresh just like the confirmation step, the QA regression test expectation (which was written for the legacy IOURequestStepAmount step) should be updated rather than changing app code.
If product wants a browser refresh on IOURequestStartPage (Manual tab) to reset the optimistic draft back to a fresh state (amount: 0, default currency):
Do not reset only amount and currency via setMoneyRequestAmount while leaving splitShares / other fields half-populated, and do not call raw initMoneyRequest directly from IOURequestStartPage.tsx:
Look at src/hooks/useResetIOUType.ts:110-147: rebuilding the optimistic draft on IOURequestStartPage requires running the full resetIOUTypeIfChanged sequence—computing earlyReportID = resolveEarlyReportID(isFromGlobalCreate, defaultParticipants), isSelfDMDefault, calling initMoneyRequest(...), and calling setTransactionReport(CONST.IOU.OPTIMISTIC_TRANSACTION_ID, {reportID: earlyReportID}, true) so that destinationReportID is defined from the embedded confirmation's first render.
In src/hooks/useResetIOUType.ts (line 101), add an optional shouldForceReset = false parameter to resetIOUTypeIfChanged:
Trigger a one-time reload reset in useResetIOUType.ts on the initial JS session mount after Onyx hydration:
Using a module-scoped guard (which starts false on a full browser page reload and stays true across in-app navigation to/from substeps like the currency, participant, merchant, or category pickers), once !isLoadingTransaction && !isLoadingSelectedTab && !!personalPolicyID, if transaction?.transactionID === CONST.IOU.OPTIMISTIC_TRANSACTION_ID && transactionRequestType === CONST.IOU.REQUEST_TYPE.MANUAL, call resetIOUTypeIfChanged(CONST.IOU.REQUEST_TYPE.MANUAL, true) once.
What alternative solutions did you explore? (Optional)
Calling setMoneyRequestAmount(transactionID, 0, defaultCurrency) alone on reload: Rejected because AmountField is inside MoneyRequestConfirmationList; resetting only amount and currency while leaving other draft fields or isAmountSet in a mixed state is inconsistent with how useResetIOUType initializes a clean Manual draft.
Calling initMoneyRequest directly in IOURequestStartPage without resolveEarlyReportID and setTransactionReport: Rejected because skipping setTransactionReport(CONST.IOU.OPTIMISTIC_TRANSACTION_ID, {reportID: earlyReportID}, true) (useResetIOUType.ts:141-143) causes destinationReportID to be undefined on the confirmation's first render, breaking the RHP fullscreen pre-insert lifecycle.
📣 @xian96xx! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Please re-state the problem that we are trying to solve in this issue.
When creating an expense on the Manual tab (Global Create -> Create expense -> Manual), selecting a different currency and entering an amount, and then refreshing the browser page (F5 / reload), the currency and amount do not reset to the user's default currency and 0.00—instead, the pre-refresh currency and amount remain populated.
When opening the expense creation page normally via the FAB (startMoneyRequest), initMoneyRequest runs and initializes transactionsDraft_1 with amount: 0 and currency: personalPolicy?.outputCurrency.
However, on a browser refresh (F5), the router mounts IOURequestStartPage directly at the current URL without calling startMoneyRequest, and Onyx rehydrates transactionsDraft_1 from storage with the stale amount, currency, isAmountSet: true, and iouRequestType: 'manual'.
In src/hooks/useResetIOUType.ts:99-102, 159-178, useFocusEffect returns early at prevTransactionReportID !== transaction?.reportID, and resetIOUTypeIfChanged returns early at transaction?.iouRequestType === newIOUType ('manual' === 'manual'), leaving the stale draft values on screen.
What changes do you think we should make in order to solve the problem?
Add a module-scoped flag let hasResetInitialGlobalCreateManualDraft = false; that is only evaluated and consumed when the global-create Manual flow (!report?.reportID && !reportID && transactionRequestType === CONST.IOU.REQUEST_TYPE.MANUAL) first hydrates after a full page load.
Add an optional shouldForceReset = false parameter to resetIOUTypeIfChanged(newIOUType: IOURequestType, shouldForceReset = false) so it can bypass transaction?.iouRequestType === newIOUType when forcing a fresh reset.
In useFocusEffect, once Onyx finishes hydrating (!isLoadingTransaction && !isLoadingSelectedTab && !!transactionRequestType && !!personalPolicyID), if isGlobalCreateManualFlow && !hasResetInitialGlobalCreateManualDraft, set hasResetInitialGlobalCreateManualDraft = true and if transactionsDraft_1 still holds persisted manual draft values (!!transaction?.amount || !!transaction?.isAmountSet || (!!transaction?.currency && !!personalPolicy?.outputCurrency && transaction.currency !== personalPolicy.outputCurrency)), call resetIOUTypeIfChanged(CONST.IOU.REQUEST_TYPE.MANUAL, true) and return.
Checking both !report?.reportID && !reportID ensures a chat-initiated flow whose report is still hydrating is never mistaken for global create.
Calling resetIOUTypeIfChanged(CONST.IOU.REQUEST_TYPE.MANUAL, true) runs the full initMoneyRequest + resolveEarlyReportID + setTransactionReport pipeline so the draft is cleanly rebuilt with amount: 0, currency: personalPolicy?.outputCurrency, and default participants.
diff --git a/src/hooks/useResetIOUType.ts b/src/hooks/useResetIOUType.ts
index 961a50b..2024d9c 100644
--- a/src/hooks/useResetIOUType.ts+++ b/src/hooks/useResetIOUType.ts@@ -23,6 +23,8 @@ import useOnyx from './useOnyx';
import usePersonalPolicy from './usePersonalPolicy';
import usePrevious from './usePrevious';
+let hasResetInitialGlobalCreateManualDraft = false;+
type UseResetIOUTypeParams = {
/** The report ID from the route params */
reportID: string;
@@ -96,8 +98,8 @@ function useResetIOUType({
});
const defaultParticipants = resolvedDefaultParticipants.length > 0 ? resolvedDefaultParticipants : undefined;
- const resetIOUTypeIfChanged = (newIOUType: IOURequestType) => {- if (transaction?.iouRequestType === newIOUType) {+ const resetIOUTypeIfChanged = (newIOUType: IOURequestType, shouldForceReset = false) => {+ if (!shouldForceReset && transaction?.iouRequestType === newIOUType) {
return;
}
@@ -163,15 +165,25 @@ function useResetIOUType({
}
tabSelectedTypeRef.current = null;
+ if (isLoadingTransaction || isLoadingSelectedTab || !transactionRequestType || !personalPolicyID) {+ return;+ }++ const isGlobalCreateManualFlow = !report?.reportID && !reportID && transactionRequestType === CONST.IOU.REQUEST_TYPE.MANUAL;+ if (isGlobalCreateManualFlow && !hasResetInitialGlobalCreateManualDraft) {+ hasResetInitialGlobalCreateManualDraft = true;+ const hasPersistedManualDraftValues =+ !!transaction?.amount ||+ !!transaction?.isAmountSet ||+ (!!transaction?.currency && !!personalPolicy?.outputCurrency && transaction.currency !== personalPolicy.outputCurrency);+ if (hasPersistedManualDraftValues) {+ resetIOUTypeIfChanged(CONST.IOU.REQUEST_TYPE.MANUAL, true);+ return;+ }+ }+
// 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 ||- isLoadingTransaction ||- isLoadingSelectedTab ||- !transactionRequestType ||- prevTransactionReportID !== transaction?.reportID ||- !personalPolicyID- ) {+ if (transaction?.reportID === reportID || prevTransactionReportID !== transaction?.reportID) {
return;
}
resetIOUTypeIfChanged(transactionRequestType);
What alternative solutions did you explore? (Optional)
Only resetting amount and currency via setMoneyRequestAmount: Leaves isAmountSet: true, modifiedAmount, category, tag, comment, and merchant dirty in transactionsDraft_1 instead of rebuilding a clean draft via initMoneyRequest.
Calling initMoneyRequest directly in IOURequestStartPage without resetIOUTypeIfChanged: Misses resolveEarlyReportID and setTransactionReport(CONST.IOU.OPTIMISTIC_TRANSACTION_ID, {reportID: earlyReportID}, true), breaking destination report pre-mounting on the embedded confirmation screen.
@Expensify/product Could you please confirm whether this is a bug? Expense fields such as Currency, Amount, Date, Description, Merchant, etc. persist after refreshing the page. It seems that the new flow intentionally preserves the draft.
Activity
MelvinBot commentedon Oct 22, 2026
Proposal
What is the root cause of that problem?
The Manual tab now saves the amount and currency to the draft transaction in Onyx on every keystroke and currency pick. Onyx keeps that draft across a page reload, and nothing on reload clears it.
AmountField.tsx:262-316:updateCurrencyandhandleAmountChangecallsetMoneyRequestCurrency/setMoneyRequestAmount, which merge intotransactionsDraft_<id>.useResetIOUType.ts:159-178: the only reset-on-focus check returns early when the draft'sreportIDmatches the URL'sreportID. That is always true after a plain refresh.This became the default with feat: remove isNewManualExpenseFlowEnabled beta flag, merged 2026-09-09. It made the embedded confirmation form the Manual tab for everyone (
IOURequestStartPage.tsx:244). Before that, the Manual tab usedIOURequestStepAmount, which kept the amount and currency in local React state until you pressed Next. A refresh threw them away, which is what the regression test still expects.What changes do you think we should make in order to solve the problem?
First, product needs to decide whether this is a bug. The new flow saves the draft on purpose. Date, Description, and Merchant also survive a refresh. If that is intended, update the regression test instead of the code.
If the draft should reset on refresh:
useResetIOUType(orIOURequestStartPage), detect the first mount after a fresh app load. A module-level flag that is unset in the current JS session works for this.initMoneyRequestto rebuild it with amount 0 and the default currency.What alternative solutions did you explore? (Optional)
Keep
AmountField's amount and currency in local state until submit. This restores the old behavior, but the embedded form reads the draft for validation and split shares, so the change is much larger.Investigation details
newManualExpenseFlowbeta. Removing the beta exposed it to all users.setMoneyRequestAmountandsetMoneyRequestCurrencymerge intoONYXKEYS.COLLECTION.TRANSACTION_DRAFT(MoneyRequest.ts:960-1015). That key is persisted, so it comes back after a reload.resetIOUTypeIfChangedalso returns early when the request type is unchanged (useResetIOUType.ts:100), so reselecting the Manual tab does not reset it either.useState(IOURequestStepAmount.tsx:136-137) and wrote to Onyx only on submit.Possibly related: [Exploratory] Login-Pre-filled amount is shown when creating expense via shortcut.. A previous amount also reappears there, which may come from the same persisted draft.
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/104703)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run · no recording available
melvin-bot commentedon Oct 22, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane (
External)[-]Expense-Currency and amount does not reset after refresh[/-][+][$175] Expense-Currency and amount does not reset after refresh[/+]melvin-bot commentedon Oct 22, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022113202613790750470
romitg2 commentedon Oct 22, 2026
Contributor details
Your Expensify account email: romitgabani1@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/romitg
Proposal
What is the root cause of that problem?
How typing an amount gets saved
There's a file called
AmountField.tsx. Every time you type a number or pick a currency, it runs a small function that writes that value into the draft (a scratchpad saved to disk, not just memory). So the moment you type "500" and pick "EUR", it's already saved, permanently, until something explicitly clears it.Why a refresh doesn't clear it
Another file,
useResetIOUType.ts, is supposed to clear old data when needed. But it only clears things when you switch tabs (like going from Manual entry to Scan). It checks "has the thing I'm looking at changed?" On a plain refresh, nothing changed, you're looking at the exact same page. So it sees "nothing changed" and does nothing. It was written to handle switching tabs, not refreshing the page, so it was never going to catch this case.What changes do you think we should make in order to solve the problem?
Confirm with product first: Date, Description, and Merchant also persist through a refresh today, so if that's intentional, only amount and currency need fixing, not the whole draft.
Where to fix it
A third file,
IOURequestStartPage.tsx, runs once when the page first loads (not on every tab switch). Add a check there: "is this the very first time this page loaded since the browser opened it?" If yes, and the user is on the Manual tab starting a brand new expense, wipe just the amount and currency back to empty/default. Leave everything else alone.The functions to clear the amount and reset the currency already exist (
clearMoneyRequestAmountandsetMoneyRequestCurrency), they're the same functions that save your typing in the first place. The fix is just calling them once, at the right moment, instead of never.What alternative solutions did you explore? (Optional)
Keep amount/currency in local state in
AmountFieldinstead of the draft, like the old flow did. Dropped this since the confirmation form reads the draft directly for validation and split shares, so it's a much bigger change for the same result.melvin-bot commentedon Oct 22, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Abdallah-1551 commentedon Oct 22, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On the global-create Manual tab (FAB → Create expense), the user picks a non-default currency and enters an amount, then reloads the page. After the reload the currency and amount are still there. The regression test expects the currency to go back to the default and the amount to go back to 0, as it did before the new manual flow.
What is the root cause of that problem?
AmountField(embedded inMoneyRequestConfirmationList) writes the amount and currency straight into the persistedtransactionsDraft_<id>Onyx key. It does this on every keystroke and currency pick, viasetMoneyRequestAmount/setMoneyRequestCurrency. The oldIOURequestStepAmountkept both in localuseStateuntil "Next", so a reload discarded them.useResetIOUType, and it returns early when the draft'sreportIDequals the URL'sreportIDor when the request type is unchanged. After a plain refresh both conditions are true, so the persisted draft is reused unchanged.isNewManualExpenseFlowEnabledbeta was removed. That is why it now shows up in regression testing.The existing proposals (MelvinBot's and romitg2's) find the same cause, and I agree with both. Neither commits to a fix, and neither covers the Onyx hydration timing or leftover split shares (see the changes below). The issue's Expected Result is explicit, so I am treating this as a bug and not deferring to a product decision.
What changes do you think we should make in order to solve the problem?
Reset only the amount and currency, once per JS session, on the first mount of the Manual tab opened from global create. A real browser reload re-evaluates the module, so the flag starts
falseagain. In-app remounts, such as coming back from the participant, category or tag pickers, keep the flagtrueand never wipe real input.Do not call
initMoneyRequest. It rebuilds the whole draft and would also wipe Date, Description, Merchant and participants, which the issue does not ask for.1. A small hook, e.g.
src/hooks/useResetManualDraftOnReload.ts2. Call the hook from
IOURequestStartPage.tsxisFromGlobalCreate, whether the selected tab isCONST.TAB_REQUEST.MANUAL, and the transaction ID.defaultCurrencythe same wayinitMoneyRequestdoes for a new draft: the policy'soutputCurrencywhen the report is a workspace one, otherwisecurrentUserPersonalDetails.localCurrencyCode, falling back toCONST.CURRENCY.USD. Extract that into a shared helper if it is not already one, so the reset value always matches a brand-new draft.3. Test isolation
Export a test-only reset for the flag, or use
jest.isolateModules, so unit tests can simulate a "fresh page load".What alternative solutions did you explore? (Optional)
AmountFielduntil submit. This mirrors the old behavior, but the embedded confirmation form reads the draft for validation and split-share calculations. It is a much larger refactor for the same outcome.initMoneyRequeston first mount. It is simple, but it wipes Date, Description, Merchant and participants, which are intentionally persisted.reportIDearly return inuseResetIOUType. This would also reset the draft on legitimate in-session remounts, such as returning from a picker, and lose the user's input.Testing
Manual (web and Android mWeb Chrome):
Unit tests:
transactionsDraft_<id>with a non-default currency and a non-zero amount, then mountIOURequestStartPageor the hook for the first time. Assert that amount is 0 and currency is the default.khizzcr7 commentedon Oct 22, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On the global-create Manual tab (FAB - Create expense), picking a non-default currency and entering an amount, then refreshing the page, keeps the stale currency and amount. Expected: currency resets to default and amount resets to 0 after a refresh.
What is the root cause of that problem?
Since PR #100215 removed the
isNewManualExpenseFlowEnabledbeta flag, the Manual tab is the embedded confirmation form (IOURequestStartPage). InAmountField.tsx,updateCurrencyandhandleAmountChangecallsetMoneyRequestCurrency/setMoneyRequestAmount, which merge into the persistedTRANSACTION_DRAFTOnyx key on every keystroke and currency pick, so the draft survives a reload.On reload, nothing clears it:
useResetIOUType's focus effect is the only reset path, and it returns early when the draft'sreportIDmatches the URL'sreportID(src/hooks/useResetIOUType.ts, theuseFocusEffectearly-return block) - which is always true after a plain refresh. Before the beta removal, the Manual tab kept amount/currency in local React state, so a refresh threw them away; that is what the regression test still expects.What changes do you think we should make in order to solve the problem?
IOURequestStartPagethat is false only on the first mount of the JS session).initMoneyRequestto rebuild the draft with amount 0 and the default currency.What alternative solutions did you explore?
Keeping
AmountField's amount and currency in local state until submit restores the old behavior, but the embedded form reads the draft for validation and split shares, so that change is much larger and riskier.I will verify: the exact repro steps from the issue on web and mWeb Chrome (non-default currency + amount, refresh - default currency and 0 restored), plus in-session navigation checks (open a picker and back - draft input preserved), and the existing IOU request tests still pass.
xian96xx commentedon Oct 26, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When creating an expense from the global create menu (FAB → Create expense → Manual tab), selecting a non-default currency and entering an amount, and then refreshing the browser page, the currency and amount remain populated instead of resetting to the default currency and
0.What is the root cause of that problem?
#100215removed theisNewManualExpenseFlowEnabledbeta flag,IOURequestStartPageembedsIOURequestStepConfirmationContentdirectly as the Manual tab (src/pages/iou/request/IOURequestStartPage.tsx:246-294) for all standard create/submit/track/split flows instead ofIOURequestStepAmount.IOURequestStepAmountkept the typed amount and selected currency in local ReactuseStateuntil the user pressed Next, the embedded confirmation form'sAmountField(src/components/MoneyRequestConfirmationList/sections/AmountField.tsx:257-319) callssetMoneyRequestCurrencyandsetMoneyRequestAmounton every currency selection and keystroke, persistingamount,isAmountSet: true, andcurrencydirectly intoONYXKEYS.COLLECTION.TRANSACTION_DRAFT(transactionsDraft_1)./create/expense/...), Onyx rehydratestransactionsDraft_1from persistent storage, anduseResetIOUType(src/hooks/useResetIOUType.ts:101-180) never resets it for two reasons:useFocusEffect(lines 169-178),prevTransactionReportID !== transaction?.reportIDisfalseoncetransactionfinishes loading (prevTransactionReportID === transaction?.reportID), ortransaction?.reportID === reportIDistrue, souseFocusEffectreturns early.resetIOUTypeIfChanged(transactionRequestType)were called,transactionRequestTypeis derived fromtransaction.iouRequestType(IOURequestStartPage.tsx:164-167), soif (transaction?.iouRequestType === newIOUType) { return; }atuseResetIOUType.ts:102-104immediately short-circuits.What changes do you think we should make in order to solve the problem?
First, note that because the Manual tab on
IOURequestStartPageis now the embedded confirmation form (PR#100215), all fields entered on the Manual tab (Amount, Currency, Merchant, Description, Category, Date) are stored inONYXKEYS.COLLECTION.TRANSACTION_DRAFT. If product intends for the embedded Manual tab draft to persist across a browser refresh just like the confirmation step, the QA regression test expectation (which was written for the legacyIOURequestStepAmountstep) should be updated rather than changing app code.If product wants a browser refresh on
IOURequestStartPage(Manual tab) to reset the optimistic draft back to a fresh state (amount: 0, default currency):amountandcurrencyviasetMoneyRequestAmountwhile leavingsplitShares/ other fields half-populated, and do not call rawinitMoneyRequestdirectly fromIOURequestStartPage.tsx:Look at
src/hooks/useResetIOUType.ts:110-147: rebuilding the optimistic draft onIOURequestStartPagerequires running the fullresetIOUTypeIfChangedsequence—computingearlyReportID = resolveEarlyReportID(isFromGlobalCreate, defaultParticipants),isSelfDMDefault, callinginitMoneyRequest(...), and callingsetTransactionReport(CONST.IOU.OPTIMISTIC_TRANSACTION_ID, {reportID: earlyReportID}, true)so thatdestinationReportIDis defined from the embedded confirmation's first render.src/hooks/useResetIOUType.ts(line 101), add an optionalshouldForceReset = falseparameter toresetIOUTypeIfChanged:useResetIOUType.tson the initial JS session mount after Onyx hydration:Using a module-scoped guard (which starts
falseon a full browser page reload and staystrueacross in-app navigation to/from substeps like the currency, participant, merchant, or category pickers), once!isLoadingTransaction && !isLoadingSelectedTab && !!personalPolicyID, iftransaction?.transactionID === CONST.IOU.OPTIMISTIC_TRANSACTION_ID && transactionRequestType === CONST.IOU.REQUEST_TYPE.MANUAL, callresetIOUTypeIfChanged(CONST.IOU.REQUEST_TYPE.MANUAL, true)once.What alternative solutions did you explore? (Optional)
setMoneyRequestAmount(transactionID, 0, defaultCurrency)alone on reload: Rejected becauseAmountFieldis insideMoneyRequestConfirmationList; resetting onlyamountandcurrencywhile leaving other draft fields orisAmountSetin a mixed state is inconsistent with howuseResetIOUTypeinitializes a clean Manual draft.initMoneyRequestdirectly inIOURequestStartPagewithoutresolveEarlyReportIDandsetTransactionReport: Rejected because skippingsetTransactionReport(CONST.IOU.OPTIMISTIC_TRANSACTION_ID, {reportID: earlyReportID}, true)(useResetIOUType.ts:141-143) causesdestinationReportIDto beundefinedon the confirmation's first render, breaking the RHP fullscreen pre-insert lifecycle.melvin-bot commentedon Oct 26, 2026
📣 @xian96xx! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Format:
shilo1979jk commentedon Oct 26, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When creating an expense on the Manual tab (
Global Create -> Create expense -> Manual), selecting a different currency and entering an amount, and then refreshing the browser page (F5/ reload), the currency and amount do not reset to the user's default currency and0.00—instead, the pre-refresh currency and amount remain populated.What is the root cause of that problem?
#100215(which embeddedIOURequestStepConfirmationContentdirectly insideIOURequestStartPageon the Manual tab atsrc/pages/iou/request/IOURequestStartPage.tsx:285-290), typing an amount or selecting a currency insrc/components/MoneyRequestConfirmationList/sections/AmountField.tsx:66,95,121immediately persistsamount,currency, andisAmountSet: truetoONYXKEYS.COLLECTION.TRANSACTION_DRAFT(transactionsDraft_1) in IndexedDB.startMoneyRequest),initMoneyRequestruns and initializestransactionsDraft_1withamount: 0andcurrency: personalPolicy?.outputCurrency.F5), the router mountsIOURequestStartPagedirectly at the current URL without callingstartMoneyRequest, and Onyx rehydratestransactionsDraft_1from storage with the staleamount,currency,isAmountSet: true, andiouRequestType: 'manual'.src/hooks/useResetIOUType.ts:99-102, 159-178,useFocusEffectreturns early atprevTransactionReportID !== transaction?.reportID, andresetIOUTypeIfChangedreturns early attransaction?.iouRequestType === newIOUType('manual' === 'manual'), leaving the stale draft values on screen.What changes do you think we should make in order to solve the problem?
In
src/hooks/useResetIOUType.ts:let hasResetInitialGlobalCreateManualDraft = false;that is only evaluated and consumed when the global-create Manual flow (!report?.reportID && !reportID && transactionRequestType === CONST.IOU.REQUEST_TYPE.MANUAL) first hydrates after a full page load.shouldForceReset = falseparameter toresetIOUTypeIfChanged(newIOUType: IOURequestType, shouldForceReset = false)so it can bypasstransaction?.iouRequestType === newIOUTypewhen forcing a fresh reset.useFocusEffect, once Onyx finishes hydrating (!isLoadingTransaction && !isLoadingSelectedTab && !!transactionRequestType && !!personalPolicyID), ifisGlobalCreateManualFlow && !hasResetInitialGlobalCreateManualDraft, sethasResetInitialGlobalCreateManualDraft = trueand iftransactionsDraft_1still holds persisted manual draft values (!!transaction?.amount || !!transaction?.isAmountSet || (!!transaction?.currency && !!personalPolicy?.outputCurrency && transaction.currency !== personalPolicy.outputCurrency)), callresetIOUTypeIfChanged(CONST.IOU.REQUEST_TYPE.MANUAL, true)and return.!report?.reportID && !reportIDensures a chat-initiated flow whosereportis still hydrating is never mistaken for global create.resetIOUTypeIfChanged(CONST.IOU.REQUEST_TYPE.MANUAL, true)runs the fullinitMoneyRequest+resolveEarlyReportID+setTransactionReportpipeline so the draft is cleanly rebuilt withamount: 0,currency: personalPolicy?.outputCurrency, and default participants.What alternative solutions did you explore? (Optional)
amountandcurrencyviasetMoneyRequestAmount: LeavesisAmountSet: true,modifiedAmount,category,tag,comment, andmerchantdirty intransactionsDraft_1instead of rebuilding a clean draft viainitMoneyRequest.initMoneyRequestdirectly inIOURequestStartPagewithoutresetIOUTypeIfChanged: MissesresolveEarlyReportIDandsetTransactionReport(CONST.IOU.OPTIMISTIC_TRANSACTION_ID, {reportID: earlyReportID}, true), breaking destination report pre-mounting on the embedded confirmation screen.melvin-bot commentedon Oct 26, 2026
sobitneupane commentedon Oct 27, 2026
@Expensify/product Could you please confirm whether this is a bug? Expense fields such as Currency, Amount, Date, Description, Merchant, etc. persist after refreshing the page. It seems that the new flow intentionally preserves the draft.
trjExpensify commentedon Oct 27, 2026
This is fine. 👍 @m-natarajan can we delete the test case?
m-natarajan commentedon Oct 28, 2026
@trjExpensify Deleted the test case for this.