Skip to content

[$175] Expense-Currency and amount does not reset after refresh #104703

Closed

Description

@nlemma

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


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.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Bug7262617_1789665896748.1789604836479_Screenrecorder-2026-09-17-05-55-13-791.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 22, 2026
  2. MelvinBot commented on Oct 22, 2026

    @MelvinBot
    Contributor

    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: 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:

    1. 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.
    2. 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.
    3. 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.
    • The old amount step held currency in useState (IOURequestStepAmount.tsx:136-137) and wrote to Onyx only on submit.
    • 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.

    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

  3. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 22, 2026
  4. melvin-bot commented on Oct 22, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane (External)

  5. 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
  6. melvin-bot commented on Oct 22, 2026

    @melvin-bot
  7. romitg2 commented on Oct 22, 2026

    @romitg2

    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 (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.

  8. melvin-bot commented on Oct 22, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  9. Abdallah-1551 commented on Oct 22, 2026

    @Abdallah-1551

    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?

    • 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.
    let hasHandledInitialManualMount = false;
    
    function useResetManualDraftOnReload({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 atomically
            setMoneyRequestAmount(transactionID, 0, defaultCurrency);
            // Per-participant split amounts derived from the old total would be inconsistent with amount 0
            if (draft.splitShares) {
                setDraftSplitTransaction/clear splitShares for this transaction
            }
        }, [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):

    1. Tap FAB → Create expense and stay on the Manual tab.
    2. Select a non-default currency (e.g. EUR) and enter an amount (e.g. 25).
    3. Reload the page. The currency should be the default and the amount 0.
    4. Repeat, but fill in Description and Merchant before reloading. Those values should still be there.
    5. Without reloading, enter an amount, open the participant or category picker and go back. The amount and currency should be preserved.
    6. Reload on the Scan, Distance and Per diem tabs and when editing an existing expense. No reset should happen.
    7. 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.
  10. khizzcr7 commented on Oct 22, 2026

    @khizzcr7

    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 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?

    1. Detect a fresh app load (a module-level flag in IOURequestStartPage that is false only on the first mount of the JS session).
    2. 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.
    3. 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.

  11. xian96xx commented on Oct 26, 2026

    @xian96xx

    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?

    1. 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.
    2. 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).
    3. 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):

    1. 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.
    2. In src/hooks/useResetIOUType.ts (line 101), add an optional shouldForceReset = false parameter to resetIOUTypeIfChanged:
      const resetIOUTypeIfChanged = (newIOUType: IOURequestType, shouldForceReset = false) => {
          if (!shouldForceReset && transaction?.iouRequestType === newIOUType) {
              return;
          }
    3. 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.
  12. melvin-bot commented on Oct 26, 2026

    @melvin-bot

    📣 @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:

    1. Make sure you've read and understood the contributing guidelines.
    2. 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.
    3. 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.
    4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    
  13. shilo1979jk commented on Oct 26, 2026

    @shilo1979jk

    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 and 0.00—instead, the pre-refresh currency and amount remain populated.

    What is the root cause of that problem?

    1. Since PR #100215 (which embedded IOURequestStepConfirmationContent directly inside IOURequestStartPage on the Manual tab at src/pages/iou/request/IOURequestStartPage.tsx:285-290), typing an amount or selecting a currency in src/components/MoneyRequestConfirmationList/sections/AmountField.tsx:66,95,121 immediately persists amount, currency, and isAmountSet: true to ONYXKEYS.COLLECTION.TRANSACTION_DRAFT (transactionsDraft_1) in IndexedDB.
    2. When opening the expense creation page normally via the FAB (startMoneyRequest), initMoneyRequest runs and initializes transactionsDraft_1 with amount: 0 and currency: personalPolicy?.outputCurrency.
    3. 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'.
    4. 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?

    In src/hooks/useResetIOUType.ts:

    1. 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.
    2. Add an optional shouldForceReset = false parameter to resetIOUTypeIfChanged(newIOUType: IOURequestType, shouldForceReset = false) so it can bypass transaction?.iouRequestType === newIOUType when forcing a fresh reset.
    3. 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.
  14. melvin-bot commented on Oct 26, 2026

    @melvin-bot

    ⚠️ Invalid email. Please make sure to create an Expensify account with this email first here.

  15. sobitneupane commented on Oct 27, 2026

    @sobitneupane
    Contributor

    @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.

  16. trjExpensify commented on Oct 27, 2026

    @trjExpensify
    Contributor

    This is fine. 👍 @m-natarajan can we delete the test case?

  17. m-natarajan commented on Oct 28, 2026

    @m-natarajan

    @trjExpensify Deleted the test case for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions