Skip to content

[$250] Expense description reverts to old value after saving from the Reports/Expenses (Search) tab #101937

Open

Description

@m-natarajan

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


Version Number:
Reproducible in staging?: Needs reproduction (Unable to reproduce)
Reproducible in production?: Needs reproduction
If this was caught during regression testing, add the test name, ID and link from BrowserStack:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @Kel-Expensify
Slack conversation (hyperlinked to channel name): #Expensify Bugs

Action Performed:

  1. Go to the Reports (or Expenses) tab in New Expensify.
  2. Open an expense from the list.
  3. Click the Description field to open the full-page editor.
  4. Type a new description and click Save.
  5. Look at the expense's Description field.

Expected Result:

The Description field shows the newly saved text immediately.

Actual Result:

The page reloads and the Description field still shows the old text. In some cases the new description appears a few seconds later; in others it never appears until the page is refreshed or the expense is reopened from the Inbox.

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

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

Screenshots/Videos

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @yusufdeveloper2903

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Sep 22, 2026
  2. changed the title [-]Tax amount change system message does not match the tax amount field when Taxes are disabled[/-] [+]Expense description reverts to old value after saving from the Reports/Expenses (Search) tab[/+] on Sep 22, 2026
  3. MelvinBot commented on Sep 22, 2026

    @MelvinBot
    Contributor

    Proposal

    ⚠️ Heads up — the title and the body describe two different bugs. The title is about a tax-amount system message on tax-disabled workspaces; the body's repro steps are about the Description field not updating after save. I analyzed the body as the primary bug (it has the repro), and included a separate section on the title bug at the end. Please confirm which one this issue is meant to track.

    I could not verify either one in a browser — browser control was unavailable for this run, so everything below is static code analysis.

    What is the root cause of that problem?

    Saving a Description edit writes the optimistic update to transactions_<id>, but the Reports/Expenses list renders from the Search snapshot key snapshot_<hash>. The save never patches the snapshot, because it never passes the hash argument that gates that write.

    The snapshot write exists and is explicitly documented — UpdateMoneyRequest.ts:121-124 says "Search result rows render from snapshot data, so TRANSACTION writes alone do not refresh the list." It is gated behind if (hash) at UpdateMoneyRequest.ts:2418-2432, and DynamicIOURequestStepDescription.tsx:156-177 never passes it — the file does not reference currentSearchHash at all.

    That matches the reported symptoms exactly: the row keeps the old text, then flips to the new text "a few seconds later" when the server response refreshes the snapshot, and a page refresh fixes it.

    Merchant and Date have the identical defect. All three were migrated together in Migrate money request merchant, description and date steps to dynamic (merged 2026-08-17), and all three dropped the hash. The sibling steps that were not in that PR thread it correctly:

    Step Passes hash?
    Description ❌
    Merchant ❌
    Date ❌
    Category ✅
    Tag ✅
    Inline editors ✅

    One caveat, stated plainly: this explains staleness on the Search list row. It does not explain a stale Description inside the opened expense detail view — I verified MoneyRequestView reads the live transactions_<id> key and sits outside SearchScopeProvider, so the snapshot redirect does not apply there. If you saw the old text in the expense's detail panel rather than in the list, this root cause is incomplete and we need an Onyx trace to find what reverts the value.

    Investigation details — what I verified and what I ruled out

    Read path. useOnyx.ts:75-106 silently rewrites a read of transactions_<id> to snapshot_<hash> when useIsOnSearch() is true. SearchScopeContext is module-private (SearchScopeProvider.tsx:9), and the only three render sites are the Search list, the Search chart, and EmptySearchView — so the redirect applies to list rows and nothing else.

    Detail view reads live Onyx. MoneyRequestView.tsx:236 → getTransactionDetails → getDescription → transaction.comment.comment. Same key the save writes.

    Ruled out — "the page reloads" is not a refetch. I initially suspected goBack produced a new route object, refiring the openReport effect in ReportFetchHandler.tsx. Traced it out and refuted it: goUp() emits exactly one StackActions.pop(1), StackRouter rebuilds by slice/concat so the surviving route keeps its object reference, and the effect does not re-run. The only escape hatch is a params mismatch forcing a REPLACE, which mints a new route key and remounts — I could not prove that fires here.

    Ruled out — snapshot clobbering the live key. Both copy-back paths are closed on this flow. openReport's snapshot merge is gated on transaction && !parentReportActionID (Report/index.ts:1859), and no caller on the back-navigation path passes transaction. setOptimisticDataForTransactionThreadPreview only runs on row click.

    Secondary gap. Even with hash passed, the snapshot write sits inside a block gated on group-policy, non-invoice expenses (UpdateMoneyRequest.ts:2344-2364). Personal-policy and self-DM expenses would still go unpatched.

    Not verified: no browser repro, no Onyx trace, no production logs.

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

    1. In each of the three dynamic step pages, read the hash with const {currentSearchHash} = useSearchQueryContext(); and pass hash: currentSearchHash into the update call — mirroring exactly what DynamicIOURequestStepCategory.tsx:113,207 already does. No changes to the action layer are needed; hash is already an accepted parameter on all three functions.
    2. Consider widening the snapshot-write gate at UpdateMoneyRequest.ts:2344-2364 so personal-policy and self-DM expenses also get the optimistic patch. I'd treat this as a follow-up, not part of the same fix.
    3. Add a regression test asserting that a Description edit dispatched with a hash writes to snapshot_<hash>, so the next step migration can't silently drop it.

    Before implementing, please confirm whether the stale field you saw was the Search list row or the field inside the opened expense. If it was the detail view, item 1 will not fix your repro.

    What alternative solutions did you explore? (Optional)

    • Navigation-triggered refetch overwriting the optimistic value — traced and refuted; see the details block.
    • Snapshot-to-live copy-back clobbering transactions_<id> — both gates verified closed on this path.
    • Having the action read currentSearchHash itself instead of threading it — rejected; the action layer is deliberately hook-free, and the existing codebase convention is to pass it from the page.

    Possibly related


    Separate bug: the issue title (tax amount system message)

    Since the title describes a different bug with no repro steps, here is a code-level read on it. Lower confidence — no repro to check against.

    Two independent defects, both real in code:

    1. Amount edits silently recompute the tax amount even when tax tracking is off. IOUAmountSubmission.ts:660-666 and TransactionInlineEdit.ts:338-356 recompute taxAmount from the policy tax rate with no isTaxTrackingEnabled guard — while the sibling create-flow path at IOUAmountSubmission.ts:589-595 does guard. Meanwhile ReportUtils.ts:6486-6498 deliberately suppresses the tax fragment when the amount changed. Net result: the Tax field moves, the system message stays frozen at the old value. Example: $100 @ 10% with a manual $5.00 tax override, edited to $200 → field shows $18.18, message still says $5.00.
    2. The message is never gated on tax tracking. The Tax rows are conditionally hidden (MoneyRequestView.tsx:605-607) but ModifiedExpenseMessage.ts:464-472 never reads policy.tax, so a "changed the tax amount" message can render for a field the user cannot see.

    Suggested fix for both: guard the two recompute sites with isTaxTrackingEnabled(...) and keep the existing taxAmount/taxCode when it returns false.

    Ruled out: sign mismatch (both sides Math.abs) and cents-vs-dollars (both sides use backend units). One thing I could not check — ModifiedExpenseMessage.ts:273 notes that ModifiedExpense::getNewDotComment in Web-Expensify must match this logic. If the backend does not apply the same suppression, the server-authored action would carry a taxAmount, and the App would render oldTaxAmount using the new currency. That needs someone with Web-Expensify access to confirm.


    💡 Suggested AI code review rule

    This looks like a recurring, mechanically detectable pattern — one PR dropped the same argument in three files at once — so it may be worth a coding-standards rule so the AI reviewer catches the next one. Proposed for Expensify/App:

    • Rule: CONSISTENCY-18 — Thread the Search snapshot hash through optimistic transaction edits
    • Condition: When a page or hook calls an updateMoneyRequest* action that accepts an optional hash, it must supply hash: currentSearchHash from useSearchQueryContext(). Without it the Search snapshot is not patched and the list row shows stale data until the server responds.
    • Why: The optimistic write to snapshot_<hash> is gated behind if (hash); Search list rows render from the snapshot, not from transactions_<id>. Introduced by Migrate money request merchant, description and date steps to dynamic.
    • Search pattern: files matching src/pages/iou/request/step/Dynamic*.tsx that call updateMoneyRequest\w+\( but contain no currentSearchHash
    • Offending code (❌): DynamicIOURequestStepDescription.tsx:156-177
    • Correct pattern (✅): DynamicIOURequestStepCategory.tsx:113 and :207

    The full rule file would go in App/.claude/skills/app-coding-standards/rules/. If it's worth adding, a maintainer can open it there as a draft PR.


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


    view run

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

    @melvin-bot

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

  6. melvin-bot commented on Sep 22, 2026

    @melvin-bot

    Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.

  7. m-natarajan commented on Sep 22, 2026

    @m-natarajan
    Author

    @MelvinBot Updated the title, Review the issue

  8. trjExpensify commented on Sep 22, 2026

    @trjExpensify
    Contributor

    @MelvinBot to clarify, all of these steps are within the actual expense view itself. So it's not about the description field in the Spend > Expenses table not updating, it's seemingly within the actual expense.

    1. Go to the Reports (or Expenses) tab in New Expensify.
    2. Open an expense from the list.
    3. Click the Description field to open the full-page editor.
    4. Type a new description and click Save.
    5. Look at the expense's Description field.
  9. MelvinBot commented on Sep 22, 2026

    @MelvinBot
    Contributor

    Review after the title update

    Thanks — the title now matches the body, so the tax-amount half of my previous comment is out of scope here. Worth filing separately if it's a real report; the two defects I described there are still in the code.

    On this issue, I dug into the one gap I flagged last time, and it resolved against my proposed fix. Headline:

    The missing hash defect is real, but it does not explain the repro as written. Don't implement it as a fix for this issue yet.

    What I confirmed

    The Description field at step 5 is MoneyRequestView, and it reads live Onyx — not the Search snapshot. This holds in both tab flows (Expenses tab → SEARCH_REPORT RHP; Reports tab → SEARCH_MONEY_REQUEST_REPORT → MoneyRequestReportView). Both land on the same widget at MoneyRequestView.tsx:1289-1313, which reads transactions_<id> directly at MoneyRequestView.tsx:236.

    This is now proven structurally rather than by grep: TAB_NAVIGATOR and RIGHT_MODAL_NAVIGATOR are sibling root-stack screens (AuthScreens.tsx:201 vs :312), every SearchScopeProvider lives under the Search tab, and React context doesn't cross that boundary.

    After Save, you land back on MoneyRequestView, not on a list row. The dynamic-route suffix is stripped and popped within the same RHP stack, so the panel underneath was never unmounted. So the stale text you're looking at is the detail panel — a live-Onyx read — and patching the snapshot cannot change it.

    What the missing hash actually explains

    Not nothing — just not this. It explains two adjacent behaviors:

    1. The Search list row behind the RHP staying stale after the edit.
    2. Your "appears a few seconds later" symptom. useSearchHighlightAndScroll.ts:104-120 notices the changed transaction in live Onyx and refires search(), which rewrites the snapshot from the server. That's the delayed heal.

    I'd still fix it — see below — but as its own defect.

    What I could not determine

    Nothing in the client code that I can prove reverts transactions_<id> on this path. The optimistic write is unconditional. I ruled out, with evidence: the navigation refetch (goUp emits a clean pop(1); route identity stable), openReport's snapshot→live merge (no caller passes transaction here, and the one that does is gated on the transaction thread not existing), search responses (they write snapshot keys only), and response-ordering via QueuedOnyxUpdates (OpenReport is a WRITE, so it serializes after the description write and its payload already has the new text).

    That leaves two live possibilities I can't separate statically: the value is genuinely overwritten by something I haven't found, or it's never overwritten and the panel simply doesn't re-render.

    Also relevant: the body says "Reproducible in staging?: Needs reproduction (Unable to reproduce)". Combined with the above, I don't think this is ready to hand to a contributor.

    What would settle it
    • An Onyx trace of transactions_<id> across the save → goBack window. If the value is overwritten, the trace names the source; if it isn't, this is a re-render bug in MoneyRequestView, which is a completely different fix.
    • Whether [Report] Legacy transaction fallback: creating money request preview fires on this flow. If it does, Report/index.ts:1906-1910 is the clobber and I was wrong to rule it out.
    • Whether the backend's UpdateMoneyRequestDescription response echoes transactions_<id> with the old comment. Not visible from the App repo.
    • A screen recording that makes clear whether the stale text is the detail panel or the list row behind it.

    Recommendation

    1. Get a repro first. A video plus an Onyx trace would settle in minutes what I can't settle statically. Without it, any fix is a guess.
    2. Fix the missing hash separately. It's a confirmed, mechanical defect from Migrate money request merchant, description and date steps to dynamic: Description, Merchant and Date all dropped the argument, while Category, Tag and the inline editors thread it. The fix is const {currentSearchHash} = useSearchQueryContext(); then hash: currentSearchHash in each of the three step pages. I verified SearchQueryProvider is an ancestor of those pages in both flows, so the hash resolves.

    One caveat on that fix, which the sibling steps already have: currentSearchHash is never undefined — it falls back to -1 at SearchQueryProvider.tsx:60, and the snapshot helper only guards if (!hash …), so -1 passes. Editing from the Inbox would then create a bogus one-transaction snapshot_-1 key. Worth guarding while you're in there. Separately, the snapshot write is nested inside a group-policy, non-invoice gate at UpdateMoneyRequest.ts:2343-2365, so personal-policy and self-DM expenses stay unpatched regardless.

    I could not verify any of this in a browser — browser control was unavailable for this run, so everything above is static code analysis.


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


    view run

  10. trjExpensify commented on Sep 22, 2026

    @trjExpensify
    Contributor

    @MelvinBot again, the bug report is entirely about within the money request view.

    1. User opens an expense
    2. Clicks on the description field to open the description edit page
    3. Edits the description and clicks save
    4. Returns to the expense
    5. The description field hasn't updated on the expense
  11. MelvinBot commented on Sep 23, 2026

    @MelvinBot
    Contributor

    ⏱️ Ran out of time before I could finish. This usually means the task was too complex or I got stuck exploring. Please try again with a more specific request or post in #melvinbot-ai.

    Run details

  12. MelvinBot commented on Sep 23, 2026

    @MelvinBot
    Contributor

    ⚠️ Low confidence — I do not have a root cause. Posting what I proved and what I eliminated, so the next person doesn't repeat it.

    Understood: the money request view, not the Search table. I took that seriously this time and traced the whole path. My Search-snapshot explanation is wrong for this surface, and I'm retracting it as the fix for this issue.

    Here's the uncomfortable result: I traced the save → Onyx → render path end to end and every link checks out. From client code alone, this bug should not happen. That means either the repro depends on something I can't see statically, or the value is being overwritten by the server.

    What I proved (so nobody re-checks it)

    Link Result
    The save writes the new description to transactions_<id> ✅ Correct — single Onyx.METHOD.MERGE of the whole updatedTransaction at UpdateMoneyRequest.ts:2174-2186; no second write to that key anywhere in the function
    getUpdatedTransaction sets comment.comment and nothing clobbers it later ✅ Correct — TransactionUtils/index.ts:846-851; every later comment mutation is guarded on a key absent from a description edit
    MoneyRequestView reads that same live key ✅ Correct — MoneyRequestView.tsx:236 → displayTransaction → getDescription
    Is it reading the Search snapshot instead? ❌ No. SearchScopeProvider has exactly three mounts — Search/index.tsx:1221, :1359, EmptySearchView.tsx:97. None wrap report content, so the redirect at useOnyx.ts:91 is inert here
    Frozen / not re-rendering? ❌ Ruled out — nonTopScreenBehavior: 'freeze' is set only on the split navigator and keys off that navigator's state, so an RHP push never freezes the screen underneath; RightModalNavigator sets none
    React.memo swallowing it? ❌ Ruled out — MoneyRequestView, MenuItemWithTopDescription and MenuItem are all plain exports, and MenuItem's title memos list title in deps
    React Compiler holding a stale value? ❌ Ruled out — the memo key is transaction, a fresh object on every Onyx merge
    OfflineWithFeedback / pendingFields.comment showing the old value? ❌ Ruled out — purely opacity/strikethrough, no previous-value fallback
    Also eliminated, from the earlier round

    Navigation refetch (goBack emits a clean pop(1); route identity stable, so the openReport effect never refires), openReport's snapshot→live merge (no caller passes transaction on this path), and response ordering via QueuedOnyxUpdates (OpenReport is a WRITE, so it serializes after the description write).

    Also worth knowing: there is no test asserting the optimistic comment.comment. UpdateMoneyRequestTest.ts:1092-1126 only asserts a violation survives. So the write path is verified by reading, not by CI.

    What's left — ranked

    1. The save silently no-ops. DynamicIOURequestStepDescription.tsx:140-144 returns early without calling the action when newComment === currentDescriptionInMarkdown, where the right-hand side is Parser.htmlToMarkdown(transaction.comment.comment). If the form submits a stale input value, or the HTML→markdown round trip makes a real edit compare equal, you get exactly your step 5: back on the expense, old text, no pending state, no network request at all. I could not prove this fires — it needs a repro.
    2. The backend echoes the old comment. UpdateMoneyRequestDescription is a Web-Expensify command I can't read from here. If its response or a Pusher update re-sends transactions_<id> with the old comment, it lands after the optimistic write and wins.
    3. The repro is on a host that passes updatedTransaction. That prop wins over live Onyx at MoneyRequestView.tsx:237 and is only set by the merge and review-duplicates confirmation pages. Unlikely given your steps, but it would produce this symptom exactly.

    The one observation that settles it

    With the expense open and DevTools on, save a description edit and check whether a UpdateMoneyRequestDescription request fires at all.

    • No request → candidate 1. Client-side no-op, fixable in the step page.
    • Request fires, field still stale → read Onyx.get('transactions_<id>').comment.comment in the console. New value = a render bug I haven't found. Old value = candidate 2, and the fix is backend, not App.

    That single check splits the remaining space and takes about a minute. Without it, any fix is a guess — and the body still says "Reproducible in staging?: Needs reproduction (Unable to reproduce)", so I don't think this is ready for a contributor proposal yet.

    Unchanged from before

    The missing hash in the Description, Merchant and Date step pages is still a real, separate defect — it makes the Search table row stale after an edit, and it plausibly explains [$250] Spend-Expense remains in description filter results after its description is changed and [Exploratory] Spend - New group row is not displayed after editing merchant on an expense.. Worth fixing on its own issue. It is not this bug.

    I could not verify any of this in a browser — browser control was unavailable for this run, so everything above is static code analysis.


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


    view run

  13. 95 remaining items

  14. github-actions commented on Oct 15, 2026

    @github-actions
    Contributor

    ⚠️ @open5588 Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format (note the mandatory sections).

  15. removed
    Help WantedApply this label when an issue is open to proposals by contributors
    on Oct 15, 2026
  16. mvtglobally commented on Oct 17, 2026

    @mvtglobally

    Issue not reproducible during KI retests. (Second week)

  17. open5588 commented on Oct 19, 2026

    @open5588

    Contributor details
    Your Expensify account email: open5588@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~0159c00273dd3bd644

  18. melvin-bot commented on Oct 19, 2026

    @melvin-bot

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

  19. open5588 commented on Oct 19, 2026

    @open5588

    Contributor details
    Your Expensify account email: open5588@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~0159c00273dd3bd644

  20. melvin-bot commented on Oct 19, 2026

    @melvin-bot

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

  21. yusufdeveloper2903 commented on Oct 22, 2026

    @yusufdeveloper2903
    Contributor

    The PR is ready for review. Thanks!

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.ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in reviewWeeklyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions