Skip to content

[Due for payment 2026-04-14] [Due for payment 2026-04-14] Reports -"Submit" button instead of "Done" if expense is created offline while on "Expenses" #87037

Closed

Description

@lanitochka17

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: 9.3.52.0
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #86460
Email or phone of affected tester (no customers): ibellicotest+2250@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Motorola MotoG60 / Android 12 (Hybrid app)
App Component: Search

Action Performed:

Prerequisite: "Track and budget expenses" selected during onboarding.
Prerequisite 2: Account has at least one workspace.
Prerequisite 3: Approvals and payments disabled.

  1. Open the Expensify app.
  2. Navigate to "Reports" > "Expenses"
  3. Turn off internet connection.
  4. Create a manual expense and submit it to workspace.
  5. Note that when expense preview appears on "Expenses", a "Submit" button is displayed instead of "Done"
  6. Navigate to "Inbox"
  7. Note that "Mark as done" is visible on chat preview.
  8. Open workspace chat.
  9. Note that "Mark as done" button is visible on expense preview.
  10. Return to "Reports" > "Expenses"
  11. Turn on internet connection.
  12. Note that "Submit" button is still visible.
  13. Navigate to "Inbox" and return.
  14. Note that now, "Done" button appears.

Expected Result:

When an expense is created while on "Expenses" section while offline, action button on preview, should automatically display "Done", if workspace has approvals and payments disabled.

Actual Result:

"Submit" button is displayed on expense preview instead of "Done", if expense is created while offline on "Expenses" section on "Reports".

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7120273_1775168376094.Done.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. added
    DeployBlockerCash
    Daily
    Bug
    on Apr 2, 2026
  2. melvin-bot commented on Apr 2, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #86460

  3. melvin-bot commented on Apr 2, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  4. github-actions commented on Apr 2, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  5. OSBotify commented on Apr 2, 2026

    @OSBotify
    Contributor

    Investigation Summary - Frontend bug. Causing PR: #86460 (Update CTA and workspace chat copy for track-intent users) by @MelvinBot - High confidence. Related Issues: #86223. Recommendation: REVERT. PR 86460 introduced a race condition where the Submit vs Mark as done button label decision depends on a policy loaded from Onyx. When an expense is created offline, the newly created iouReport may not yet have its policyID written into Onyx (or the policy entry itself may not be present), causing isSubmitAndClose(policy) to return false (since policy is undefined). This makes the button fall back to Submit instead of Done. Once connectivity is restored the Onyx store is updated and the correct policy data becomes available, explaining why the button fixes itself after navigating away and back. Labels: No label changes. DeployBlockerCash is correctly applied; this is a staging-only bug caused by an App PR. Evidence: (1) The melvin-bot explicitly linked this deploy blocker to PR 86460. (2) Bug reproduces only in staging, consistent with PR 86460 being in the staging deploy. (3) The repro requires offline expense creation + track-intent user + workspace with approvals disabled - exactly what PR 86460 targets. (4) Bug self-corrects after navigating away and back, consistent with Onyx loading policy data once network is restored. Verification: Key file src/components/ReportActionItem/MoneyRequestReportPreview/SubmitActionButton.tsx was modified by PR 86460. Button text logic: isTrackIntentUser AND isSubmitAndClose(policy) ? markAsDone : submit. policy is fetched via useOnyx on COLLECTION.POLICY keyed by iouReport.policyID. When offline with freshly created report, policyID may not be in Onyx yet so policy is undefined. isSubmitAndClose(undefined) returns false because undefined.approvalMode is not OPTIONAL. Root Cause: PR 86460 did not account for the offline scenario where policy is not yet loaded in Onyx during optimistic expense creation. Fix needs to handle the case where policy is temporarily unavailable and preserve the Mark as done label.

  6. MelvinBot commented on Apr 2, 2026

    @MelvinBot
    Contributor

    Proposal

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

    When a track-intent user creates an expense offline while on the "Expenses" tab in Reports, the action button shows "Submit" instead of "Done". It persists even after going back online until the user navigates away and back.

    What is the root cause of that problem?

    The mobile layout for individual transaction search items uses UserInfoAndActionButtonRow, which passes policyID={item.policyID} to ActionCell (UserInfoAndActionButtonRow.tsx:77).

    The item here is a TransactionListItemType, which extends the Transaction type. The Transaction type does not have a policyID field — that field only exists on Report. When the search API returns data from the backend, it adds policyID to the flat transaction data for convenience, so item.policyID works. But when an expense is created offline, the optimistic search snapshot uses a regular Transaction object (spread at IOU/index.ts:12078-12084), which has no policyID.

    As a result, ActionCell looks up useOnyx('policy_undefined'), gets undefined back, and isSubmitAndClose(actionCellPolicy) returns false — so the button falls back to "Submit" instead of "Done".

    Notably, the large screen layout does NOT have this bug: TransactionItemRow correctly passes policyID={report?.policyID} (TransactionItemRow/index.tsx:442), which works because the report IS included in the optimistic snapshot and has a valid policyID.

    The LHN and report preview also work correctly because they use different components (OptionRowLHN and SubmitActionButton) that resolve the policy through the report's policyID.

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

    In UserInfoAndActionButtonRow.tsx, change line 77 from:

    policyID={item.policyID}

    to:

    policyID={item.policyID || (item as TransactionListItemType).report?.policyID}

    This adds a fallback to the report's policyID (which is always available on the TransactionListItemType's report field, even for optimistic data), matching the approach already used by TransactionItemRow.

    Supporting evidence

    Key code paths:

    • ActionCell determines "Done" vs "Submit" at ActionCell/index.tsx:87: const shouldUseMarkAsDone = isTrackIntentUser && isSubmitAndClose(actionCellPolicy) && action === CONST.SEARCH.ACTION_TYPES.SUBMIT;
    • actionCellPolicy is loaded via useOnyx using the policyID prop at line 46
    • Optimistic snapshot data at IOU/index.ts:12064-12098 includes the policy and report objects, but the transaction is spread from a regular Transaction (no policyID)
    • TransactionListItem already computes a fallback policyID at line 79: const policyID = transactionItem.policyID || snapshotReport?.policyID || activePolicyID; — but this value is NOT passed to UserInfoAndActionButtonRow

    Why it persists after going online (step 12): The search snapshot data isn't re-fetched on reconnect — it requires navigation away/back to trigger a fresh search API call which returns backend data with policyID on the transaction.


    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  7. jasperhuangg commented on Apr 3, 2026

    @jasperhuangg
    Contributor

    reverting #86460 in #87106, should fix this

  8. m-natarajan commented on Apr 3, 2026

    @m-natarajan

    Mark as done button not displayed, Galaxy A55/ Android 16, v9.3.52-3 PR: 87106 Ad-hoc

    repro-.issue.87037.mp4
  9. 1 remaining item

  10. removed
    DeployBlockerCash
    on Apr 7, 2026
  11. added
    Weekly
    Awaiting Payment
    and removed
    Hourly
    on Apr 7, 2026
  12. melvin-bot commented on Apr 7, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.52-9 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-04-14. 🎊

  13. changed the title [-]Reports -"Submit" button instead of "Done" if expense is created offline while on "Expenses"[/-] [+][Due for payment 2026-04-14] Reports -"Submit" button instead of "Done" if expense is created offline while on "Expenses"[/+] on Apr 7, 2026
  14. melvin-bot commented on Apr 7, 2026

    @melvin-bot

    @Valforte The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  15. melvin-bot commented on Apr 7, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  16. added
    Weekly
    and removed
    Weekly
    on Apr 7, 2026
  17. changed the title [-][Due for payment 2026-04-14] Reports -"Submit" button instead of "Done" if expense is created offline while on "Expenses"[/-] [+][Due for payment 2026-04-14] [Due for payment 2026-04-14] Reports -"Submit" button instead of "Done" if expense is created offline while on "Expenses"[/+] on Apr 7, 2026
  18. melvin-bot commented on Apr 7, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.53-7 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-04-14. 🎊

  19. melvin-bot commented on Apr 7, 2026

    @melvin-bot

    @Valforte @mallenexpensify The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

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

Metadata

Metadata

Labels

Awaiting PaymentBugEngineeringWeekly

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions