Skip to content

[$175] [Exploratory] Login-Pre-filled amount is shown when creating expense via shortcut. #101340

Open

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: V9.4.80-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/Mobile-Expensify/pull/14085
Email or phone of affected tester (no customers): dreamnitethedragon+vegst@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Redmi note 10s android 13
App Component: Money Requests

Action Performed:

Scenario 1

  1. Login gmail via track business expenses
  2. Go to home and Kill app
  3. Long press app and select create expense
  4. Enter amount and tap center navigation button
  5. Long press app and select create expense
  6. Note pre-filled amount is shown

Scenario 2

  1. Login gmail via track business expenses
  2. Go to home and Kill app
  3. Long press app and select create expense
  4. Enter amount and tap center navigation button
  5. Long press app and select distance expense
  6. Tap center navigation button
  7. Long press app and select create expense
  8. Note amount field is empty ( expected)
  9. Enter amount and tap center navigation button
  10. Long press app and select distance expense
  11. Tap center navigation button
  12. Long press app and select create expense
  13. Note pre-filled amount is shown

Expected Result:

Pre-filled amount must not be shown when creating expense via shortcut.

Actual Result:

Pre-filled amount is shown when creating expense via shortcut.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7261131_1789567585480.Screenrecorder-2026-09-16-19-30-06-141.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7261131

Upwork Automation - Do Not Edit

Activity

  1. applause-bot commented on Sep 16, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/54867d38c1d0ac06e8db4cb3d1806fdd914bc2de5f4d2ddb5754e6b92ad3dc76

  2. MelvinBot commented on Sep 26, 2026

    @MelvinBot
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When you open "Create expense" from the Android app shortcut a second time, the amount from the last unfinished expense is still shown.

    What is the root cause of that problem?

    The shortcut deep link goes straight to the create screen for the shared draft transaction (OPTIMISTIC_TRANSACTION_ID). Nothing on that path clears the old draft. The inline amount field saves the amount to the draft on every keystroke, so the amount outlives the screen.

    The draft is reset in only two cases, and neither one happens here:

    1. Same screen is still open (Scenario 1). The /manual skip rule in subscribe.ts:20 drops the second shortcut link because the manual tab is already focused. The old screen and draft stay.
    2. Screen remounts. resetIOUTypeIfChanged exits early when the draft's request type matches the new one (useResetIOUType.ts:100). A manual draft opened as manual again keeps its amount.

    This also explains Scenario 2. On the first distance visit, the distance tab is not saved yet, so switching tabs changes the type and the draft is rebuilt with no amount. On the second visit, the tab is already saved, the draft type stays manual, and the amount survives.

    The in-app start route does clear the draft (IOURequestRedirectToStartPage.tsx:43), but the shortcut does not go through it.

    What changes do you think we should make in order to solve the problem?

    1. In subscribe.ts, after the skip checks and before listener(url), detect shortcut create URLs (/create/<type>/start/1/<reportID>/manual|scan|distance-new). Call clearMoneyRequest(OPTIMISTIC_TRANSACTION_ID, ...) for them, the same way IOURequestRedirectToStartPage does. The page then remounts with no draft, and useResetIOUType builds a fresh one.
    2. Do the same for a cold start in the initial-URL path of DeepLinkHandler.
    3. Narrow the /manual skip rule so it still drops the link when the draft is empty, but not when it has an amount (isAmountSet). Otherwise Scenario 1 still fails because the link never reaches navigation.

    What alternative solutions did you explore? (Optional)

    • Reset on the page. Force a full re-init in useResetIOUType when the draft is stale (IOURequestStartPage already computes a stale flag, and DistanceRequestStartPage would need the same). This is riskier: a web refresh on a create URL could wipe input the user just typed.
    • Point the shortcut at the start/... route, which already clears the draft. That change is outside the App repo, and step 3 is still needed.
    Supporting evidence
    • The skip rules were added in Fix: SmartScan shortcut re-navigates when already on SmartScan screen.
    • Each keystroke calls setMoneyRequestAmount, which sets amount and isAmountSet: true on the draft. The field then reads the stored value on mount.
    • onTabSelected in OnyxTabNavigator fires only when the tab differs from the saved tab, which is why the second distance visit does not reset the draft.
    • Not verified on a device: the exact shortcut URL, and that the "center navigation button" is the Android Home button. Both scenarios match this reading of the code.

    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/101340) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.


    view run

  3. melvin-bot commented on Sep 29, 2026

    @melvin-bot

    @aimane-chnaif Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  4. aimane-chnaif commented on Oct 1, 2026

    @aimane-chnaif
    Contributor

    @MelvinBot draft PR for testing

  5. MelvinBot commented on Oct 1, 2026

    @MelvinBot
    Contributor

    🤖 Draft PR created: Clear the old expense draft when a quick-action shortcut opens the create screen
    Please mark it as "Ready for review" when it is ready for review.

    It clears the stale draft when a shortcut opens the create screen:

    • Create screen not open: the draft is cleared before the link navigates, so the screen builds a fresh one (Scenario 2).
    • Manual tab already open: the link is still dropped to avoid re-navigating, but the amount is cleared in place (Scenario 1).
    • Cold start: the draft is cleared before the first screen mounts. This runs only on iOS and Android, so a web refresh keeps the user's input.

    GPS links are left alone so a tracked trip isn't lost.

    I haven't tested this on a device. Unit tests, typecheck, lint, and spell check pass. Please run both scenarios on Android with a build of this branch.


    view run

  6. melvin-bot commented on Oct 6, 2026

    @melvin-bot

    @aimane-chnaif Huh... This is 4 days overdue. Who can take care of this?

  7. 1 remaining item

  8. melvin-bot commented on Oct 12, 2026

    @melvin-bot

    @aimane-chnaif 10 days overdue. I'm getting more depressed than Marvin.

  9. melvin-bot commented on Oct 14, 2026

    @melvin-bot

    @aimane-chnaif 12 days overdue. Walking. Toward. The. Light...

  10. melvin-bot commented on Oct 19, 2026

    @melvin-bot

    This issue has not been updated in over 14 days. @aimane-chnaif eroding to Weekly issue.

  11. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 22, 2026
  12. MelvinBot commented on Oct 23, 2026

    @MelvinBot
    Contributor

    Proposal

    This updates my earlier proposal to match the approach in the draft PR Clear the old expense draft when a quick-action shortcut opens the create screen. That PR passed both scenarios on an Android build.

    Please re-state the problem that we are trying to solve in this issue.

    When you open "Create expense" from the app shortcut again, the amount from the last unfinished expense is still shown.

    What is the root cause of that problem?

    The shortcut opens the create screen directly for the shared draft (OPTIMISTIC_TRANSACTION_ID). It skips the start/... redirect, which is the only place that clears the old draft (IOURequestRedirectToStartPage.tsx:49). The amount field saves each keystroke to the draft, so the amount outlives the screen.

    Nothing else resets it:

    1. Scenario 1: the manual tab is still focused, so the /manual skip rule drops the new link (subscribe.ts:20). The old screen and amount stay.
    2. Scenario 2: the screen remounts, but resetIOUTypeIfChanged exits early when the draft is already manual (useResetIOUType.ts:100). The first distance visit changes the saved tab and rebuilds the draft. The second visit does not, so the amount survives.

    What changes do you think we should make in order to solve the problem?

    Clear the old draft whenever a shortcut create link arrives. A shortcut create link matches /create/<type>/start/1/<reportID>/manual|scan|distance-new.

    1. Link arrives while the app is running (subscribe.ts): clear the draft before passing the link on. The screen then builds a fresh draft.
    2. Manual tab already open (subscribe.ts): keep dropping the link so the screen does not re-navigate, but reset the amount in place (amount: 0, isAmountSet: false).
    3. Cold start (DeepLinkHandler): clear the draft before the first screen mounts. Run this only on iOS and Android, and only once, so a web refresh keeps what the user typed.
    4. Skip GPS links (.../distance-gps), because they reopen a trip that is still being tracked.
    5. Put the two Onyx writes in a small module that imports only Onyx. Importing MoneyRequest from linkingConfig creates a circular import.
    6. Add unit tests for each case in linkingConfigSubscribeTest.

    What alternative solutions did you explore? (Optional)

    • Reset on the page when the draft is stale. This is riskier: a web refresh on a create URL could wipe input.
    • Point the shortcut at the start/... route. That change is outside the App repo, and Scenario 1 would still need step 2.

    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/101340) to create a draft PR. The draft PR above already implements it.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.


    view run

  13. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 23, 2026
  14. melvin-bot commented on Oct 23, 2026

    @melvin-bot

    Current assignee @aimane-chnaif is eligible for the External assigner, not assigning anyone new.

  15. changed the title [-][Exploratory] Login-Pre-filled amount is shown when creating expense via shortcut.[/-] [+][$175] [Exploratory] Login-Pre-filled amount is shown when creating expense via shortcut.[/+] on Oct 23, 2026
  16. melvin-bot commented on Oct 23, 2026

    @melvin-bot
  17. aimane-chnaif commented on Oct 23, 2026

    @aimane-chnaif
    Contributor

    I ended up opening my own PR since Melvin's solution is wrong.

    Scenario 1 is not bug.
    Scenario 2 is bug. And that root cause leads to another bad bug below. The PR fixes both.

    1. Long press the app icon and tap Create expense.
    2. On the Manual tab, enter 25, then press the Android Home button.
    3. Long press the app icon and tap Track distance. The Map tab opens with Start and Stop.
    4. Tap Start.

    Expected Result: The Start address search opens.
    Actual Result: "Hmm... it's not here" / "Oops, this page cannot be found".

    bug.mov
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 contributorNot a priority

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions