Skip to content

[Due for payment 2026-10-01] Reports - Add existing expense to report doesn't work #102003

Closed

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: 9.4.92-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/folder/57605190/test-cases/41237114
Email or phone of affected tester (no customers): gatantm+967@gmail.com
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: iPhone 12 mini, iOS 16.7
App Component: Money Requests

Action Performed:

  1. Launch new Expensify logged in with an account with unreported expenses
  2. Tap on Fab > Create new report
  3. Tap on Add expense > Add existing expense
  4. Tap and hold on any of the expenses and tap Select

Expected Result:

When going to Add existing expense the expenses on draft reports or you are shown with multi select enabled

Actual Result:

When going to Add existing expense the expenses on draft reports or you are shown but multi select is not enabled. Trying to enable it by tapping and holding on an expense and tapping Select does nothing most of the times

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7266912_1790145986229.RPReplay_Final1790145430.mp4

View all open jobs on GitHub

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

Issue OwnerCurrent Issue Owner: @Krishna2323

Activity

  1. applause-bot commented on Sep 23, 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/ecf1995f188e150253d985b8bf9399fa9999bc0c9fcd91c36a85bc8638726278

  2. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Sep 23, 2026
  3. github-actions commented on Sep 23, 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.
  4. melvin-bot commented on Sep 23, 2026

    @melvin-bot

    Triggered auto assignment to @rlinoz (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  5. melvin-bot commented on Sep 23, 2026

    @melvin-bot

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

  6. MelvinBot commented on Sep 23, 2026

    @MelvinBot
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: feat: use Table component for Add existing expense flow - "feat: use Table component for Add existing expense flow" by @Krishna2323 (High confidence)
    Related Issues: Deploy Checklist: New Expensify 2026-09-23

    Recommendation: REVERT

    #100886 migrated Add existing expense from SelectionList canSelectMultiple (checkboxes always visible) to the shared Table component, which on small screens hides selection until the app‑global mobile selection mode is turned on — so multi‑select is no longer enabled by default on iOS/Android, which is exactly the expected result in the failing TC. The PR is self‑contained (the old SelectionList path and UnreportedExpenseListItem still exist, and nothing merged after it touches these files), so a revert is clean.

    Assigned: @Krishna2323 (PR author), @JS00001 and @situchan (approving reviewers) from highest-confidence causing PR only
    Labels: No changes. DeployBlockerCash is kept (App PR caused it, App deploy stays blocked). DeployBlocker was not present, so nothing was removed.

    📋 Detailed Analysis

    Evidence

    • Reproducible on staging (9.4.92-0) only, not production — consistent with a PR in the current checklist.
    • #100886 is listed in Deploy Checklist: New Expensify 2026-09-23 and merged 2026-09-22T16:28:32Z, ~15h before this was reported.
    • Every commit that currently touches the Add existing expense screen and the Table selection code on staging comes from that PR's branch (krishna2323/table-add-existing-expense-100589): 666fafddf, 29ac9fb49 ("fix: mobile selection mode … in Add existing expense"), e296c8715, e6f1d8451, 37173ffe5, 6a35679ce. No other checklist PR touches this path.
    • The PR itself already contains a partial fix for this exact symptom — commit 37173ffe5, "fix: only let the report header turn off the shared selection mode when focused" — which is direct evidence the author hit "Select does nothing" while building this.

    Behaviour change (the deterministic half of the bug):

    Why "Select does nothing most of the times" (the flaky half):

    Table drives the app‑global ONYXKEYS.RAM_ONLY_MOBILE_SELECTION_MODE flag, and it writes it asynchronously via Onyx.merge inside a useLayoutEffect that closes the bottom‑docked modal in the same tick (Table.tsx#L455-L463, Table.tsx#L287-L294). Several other mounted consumers can immediately flip that same flag back off:

    Native‑only fits: the "Select" handler takes an iOS‑only branch (Table.tsx#L443-L448 — getPlatform() returns web/mobileWeb on mWeb), and the deferred onModalHide reset (Table.tsx#L541-L549) is animation‑timed on native, which widens the window for another writer to win the race.

    Verification

    Affected files, all modified by #100886:

    File Role
    src/pages/AddExistingExpense.tsx screen swapped from SelectionList to Table
    src/components/Tables/AddExistingExpenseTable/index.tsx + AddExistingExpenseTableRow.tsx new table, row press is a no‑op on small screens
    src/components/Table/Table.tsx long‑press "Select" modal, setMobileSelectionModeEnabled
    src/components/Table/middlewares/selection.ts selection‑mode sync effects
    src/components/MoneyReportHeader.tsx partial isFocused fix for this exact symptom

    gh api "repos/Expensify/App/commits?path=<file>&sha=staging" shows this PR's branch as the only source of recent changes to each of them, and gh pr view 100886 --json files confirms all of them are in the PR.

    Root Cause

    The migration replaced an always‑multi‑select list with the shared Table, whose small‑screen selection is gated behind a single app‑global Onyx flag (RAM_ONLY_MOBILE_SELECTION_MODE). Two consequences:

    1. Multi‑select is no longer on by default on narrow native layouts, so the screen opens without checkboxes and row taps do nothing — the reported "multi select is not enabled".
    2. Turning it on via long‑press → Select is an async Onyx.merge into globally shared state that other mounted screens (notably the underlying, nearly empty report header) also write, so the flag frequently gets cleared right after it is set — the reported "does nothing most of the times".

    💡 Suggested AI code review rule

    This bug leans on a recurring, mechanically detectable pattern, so it may be worth a coding-standards rule so the AI reviewer catches the next one. Proposed for Expensify/App (.claude/skills/app-coding-standards):

    • Rule: CLEAN-REACT-PATTERNS-10 — Never write Onyx state during render
    • Condition: Flag a call to an Onyx-writing action (Onyx.merge/Onyx.set/Onyx.update, or a @userActions/@libs/actions helper that wraps one, e.g. turnOffMobileSelectionMode()) that sits directly in a component body rather than in a useEffect/useLayoutEffect or an event handler. Move it into an effect or a handler, or derive the value instead of storing it.
    • Why: A render-phase Onyx write is a side effect on shared global state that runs on every render of every mounted instance, including background screens, so it silently clobbers state another screen just set, and the failure is timing-dependent and platform-specific. That is what makes long-press → "Select" fail intermittently here.
    • Search pattern: rg -n '^\s{4,8}(Onyx\.(merge|set|update)|turn(On|Off)[A-Za-z]+|set[A-Z][A-Za-z]*Onyx)\(' src/**/*.tsx then discard hits whose nearest enclosing function is a useEffect/useLayoutEffect/handler. AST form: a CallExpression to an Onyx-writing callee whose nearest enclosing function is the component function itself.
    • Offending code (❌): src/components/MoneyReportHeader.tsx#L102-L109
    • Fix (✅): move that turnOffMobileSelectionMode() into a useEffect keyed on [isMobileSelectionModeEnabled, shouldUseNarrowLayout, isFocused, visibleTransactions.length]; the PR's isFocused guard only narrows the window instead of removing the render-phase write.

    Note the related event-in-effect shape in Table.tsx#L438-L463 (press handler sets state, a useLayoutEffect performs the action) is already covered by the existing PERF-8 — Handle events in handlers, so no new rule is proposed for it.

    The full rule file, with the ❌/✅ code inline in the App coding-standards format, would go in Expensify/App itself. If it's worth adding, a maintainer can open it there as a draft PR.

  7. MelvinBot commented on Sep 23, 2026

    @MelvinBot
    Contributor

    🤖 Investigation complete — see my analysis above.

    Short version: feat: use Table component for Add existing expense flow swapped Add existing expense from SelectionList canSelectMultiple (checkboxes always visible) to the shared Table, which hides selection on small screens until the app-global mobile selection mode flag is on — and that flag gets clobbered by other mounted screens, so long-press → Select often does nothing. Recommendation: revert, the PR is self-contained and the old SelectionList path still exists.

    One caveat: I could not verify this in a browser or on a device in this run — browser control was unavailable, and the bug is native-only (iOS/Android app) anyway, so web wouldn't have reproduced it. The analysis is from code and git history alone. Someone should confirm the repro on a native build before the revert lands.


    Next Steps: Reply with @MelvinBot <your feedback> to refine this analysis.


    view run

  8. melvin-bot commented on Sep 23, 2026

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

  9. situchan commented on Sep 23, 2026

    @situchan
    Contributor

    This was working at the time of C+ approval.
    Looks like 37173ff (later commit after my approval) caused this while addressing Jack's feedback before merge.

    Image

    If you think the engineer's requested changes is risky after C+ approval, feel free to ask C+ for retest before merge.

  10. melvin-bot commented on Sep 23, 2026

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

  11. removed their assignment
    on Sep 23, 2026
  12. m-natarajan commented on Sep 23, 2026

    @m-natarajan

    Xiaomi Redmi Note 10 / Android 12
    ap 9.4.92-2
    Passed

    Screenrecorder-2026-09-23-15-40-13-382.mp4
  13. changed the title [-]Reports - Add existing expense to report doesn't work[/-] [+][Due for payment 2026-10-01] Reports - Add existing expense to report doesn't work[/+] on Sep 24, 2026
  14. melvin-bot commented on Sep 24, 2026

    @melvin-bot

    @Krishna2323 / @situchan

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.92-8 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-10-01. 🎊

    The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ 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]. If no checklist is needed for this issue, you can click: [no checklist button]

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2Engineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions