Skip to content

[Due for payment 2026-04-23] Expense - Second expense does not auto appear in expense preview #87201

Closed

Description

@mitarachim

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.53-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: #86636
Email or phone of affected tester (no customers): sjoinjojsodidsjodjso@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.2 / Chrome
App Component: Money Requests

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create an expense.
  4. Create another expense in the workspace chat.
  5. Open another chat.
  6. Go back to workspace chat.

Expected Result:

In Step 4, the second expense will auto appear in expense preview.

Actual Result:

In Step 4, the second expense does not auto appear in expense preview.
In Step 6, the second expense only appears in expense preview after navigating away and back.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7123242_1775525231542.2.mp4

View all open jobs on GitHub

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    DeployBlockerIndicates it should block deploying the API
    on Apr 7, 2026
  2. melvin-bot commented on Apr 7, 2026

    @melvin-bot

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

  3. melvin-bot commented on Apr 7, 2026

    @melvin-bot

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

  4. github-actions commented on Apr 7, 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. MelvinBot commented on Apr 7, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    The Onyx bump to 3.0.58 (PR #86636) introduced structural sharing in fastMerge and removeNestedNullValues. Previously, removeNestedNullValues always created a new object reference. Now it returns the original reference when no nulls are found.

    The derived compute function in reportTransactionsAndViolations.ts mutates currentValue in place and returns the same object reference (lines ~32-85). When a second expense is created:

    1. The compute function adds the new transaction to the existing currentValue object and returns it (same reference)
    2. removeNestedNullValues sees no nulls, returns the same reference (new structural sharing behavior)
    3. Onyx's keyChanged (OnyxUtils.js:549) checks lastConnectionCallbackData === value — since it's the same reference, it skips the subscriber callback entirely
    4. useOnyx never fires, MoneyRequestReportPreview never re-renders, and the new expense doesn't appear

    Other derived configs like sortedReportActions correctly create new references via spread ({...currentValue}), which is why only this specific data path is affected.

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

    In src/libs/actions/OnyxDerived/configs/reportTransactionsAndViolations.ts, the compute function should return a new top-level reference when the data has changed, rather than mutating and returning currentValue. This ensures Onyx's reference-equality checks detect the change and notify subscribers.

    The pattern already exists in other derived configs — sortedReportActions.ts uses {...currentValue.sortedActions} to create fresh references.

    What alternative solutions did you explore?

    1. Revert the Onyx bump — would fix the issue but loses all structural sharing performance improvements.
    2. Change Onyx's keyChanged to skip reference equality for skipCacheCheck keys — would work but is a broader change to Onyx internals and could mask other mutation bugs.
    3. Create new reference in the compute function (recommended) — minimal, targeted fix that aligns with how other derived configs already work.
    Supporting evidence
    • reportTransactionsAndViolations.ts:32 — const reportTransactionsAndViolations = currentValue ?? {}; reuses the same object when currentValue is truthy
    • reportTransactionsAndViolations.ts:79-85 — mutates the object in place: reportTransactionsAndViolations[reportID].transactions[transactionKey] = transaction
    • node_modules/react-native-onyx/dist/utils.js:122-148 — removeNestedNullValues returns value (not a new result) when no nulls found
    • node_modules/react-native-onyx/dist/OnyxUtils.js:549 — lastConnectionCallbackData.get(subscriber.subscriptionID) === value skips callback on reference match
    • Contrast with sortedReportActions.ts:48-50 which correctly spreads: const sortedActions = {...currentValue.sortedActions}

    Possibly related issue: #87200 (deleted expense skeleton loader) may share the same root cause — the structural sharing change prevents re-renders when pendingAction: null is stripped by removeNestedNullValues, making the merge a no-op with no reference change.


    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.

  6. m-natarajan commented on Apr 7, 2026

    @m-natarajan

    Dupe of #87179, Closing

  7. melvin-bot commented on Apr 7, 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.

  8. added
    ReviewingHas a PR in review
    and removed
    ReviewingHas a PR in review
    on Apr 9, 2026
  9. changed the title [-]Expense - Second expense does not auto appear in expense preview[/-] [+][Due for payment 2026-04-23] Expense - Second expense does not auto appear in expense preview[/+] on Apr 16, 2026
  10. melvin-bot commented on Apr 16, 2026

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  11. melvin-bot commented on Apr 16, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.59-4 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-23. 🎊

  12. melvin-bot commented on Apr 16, 2026

    @melvin-bot

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

Assignees

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2DeployBlockerIndicates it should block deploying the APIEngineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions