[$250] Expense description reverts to old value after saving from the Reports/Expenses (Search) tab
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:
- Go to the Reports (or Expenses) tab in New Expensify.
- Open an expense from the list.
- Click the Description field to open the full-page editor.
- Type a new description and click Save.
- 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
- [x] Windows: Chrome
- [x] MacOS: Chrome / Safari
Screenshots/Videos
Issue Owner
Current Issue Owner: @yusufdeveloper2903
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?
- In each of the three dynamic step pages, read the hash with
const {currentSearchHash} = useSearchQueryContext();and passhash: currentSearchHashinto the update call — mirroring exactly whatDynamicIOURequestStepCategory.tsx:113,207already does. No changes to the action layer are needed;hashis already an accepted parameter on all three functions. - Consider widening the snapshot-write gate at
UpdateMoneyRequest.ts:2344-2364so 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. - Add a regression test asserting that a Description edit dispatched with a
hashwrites tosnapshot_<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
currentSearchHashitself 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
- [$250] Spend-Expense remains in description filter results after its description is changed (
Expensify/App#96982, open) — also a description edit not reflected in Search results. Same snapshot-staleness family; may share this root cause.
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:
- Amount edits silently recompute the tax amount even when tax tracking is off.
IOUAmountSubmission.ts:660-666andTransactionInlineEdit.ts:338-356recomputetaxAmountfrom the policy tax rate with noisTaxTrackingEnabledguard — while the sibling create-flow path atIOUAmountSubmission.ts:589-595does guard. MeanwhileReportUtils.ts:6486-6498deliberately 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. - The message is never gated on tax tracking. The Tax rows are conditionally hidden (
MoneyRequestView.tsx:605-607) butModifiedExpenseMessage.ts:464-472never readspolicy.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 snapshothashthrough optimistic transaction edits - Condition: When a page or hook calls an
updateMoneyRequest*action that accepts an optionalhash, it must supplyhash: currentSearchHashfromuseSearchQueryContext(). 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 behindif (hash); Search list rows render from the snapshot, not fromtransactions_<id>. Introduced by Migrate money request merchant, description and date steps to dynamic. - Search pattern: files matching
src/pages/iou/request/step/Dynamic*.tsxthat callupdateMoneyRequest\w+\(but contain nocurrentSearchHash - Offending code (❌):
DynamicIOURequestStepDescription.tsx:156-177 - Correct pattern (✅):
DynamicIOURequestStepCategory.tsx:113and: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.
Triggered auto assignment to Contributor-plus team member for initial proposal review - @linhvovan29546 (External)
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
@MelvinBot Updated the title, Review the issue
@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.
- Go to the Reports (or Expenses) tab in New Expensify.
- Open an expense from the list.
- Click the Description field to open the full-page editor.
- Type a new description and click Save.
- Look at the expense's Description field.
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
hashdefect 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:
- The Search list row behind the RHP staying stale after the edit.
- Your "appears a few seconds later" symptom.
useSearchHighlightAndScroll.ts:104-120notices the changed transaction in live Onyx and refiressearch(), 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 inMoneyRequestView, which is a completely different fix. - Whether
[Report] Legacy transaction fallback: creating money request previewfires on this flow. If it does,Report/index.ts:1906-1910is the clobber and I was wrong to rule it out. - Whether the backend's
UpdateMoneyRequestDescriptionresponse echoestransactions_<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
- 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.
- Fix the missing
hashseparately. 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 isconst {currentSearchHash} = useSearchQueryContext();thenhash: currentSearchHashin each of the three step pages. I verifiedSearchQueryProvideris 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.
@MelvinBot again, the bug report is entirely about within the money request view.
- User opens an expense
- Clicks on the description field to open the description edit page
- Edits the description and clicks save
- Returns to the expense
- The description field hasn't updated on the expense
⏱️ 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.
⚠️ 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
- The save silently no-ops.
DynamicIOURequestStepDescription.tsx:140-144returns early without calling the action whennewComment === currentDescriptionInMarkdown, where the right-hand side isParser.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. - The backend echoes the old comment.
UpdateMoneyRequestDescriptionis aWeb-Expensifycommand I can't read from here. If its response or a Pusher update re-sendstransactions_<id>with the oldcomment, it lands after the optimistic write and wins. - The repro is on a host that passes
updatedTransaction. That prop wins over live Onyx atMoneyRequestView.tsx:237and 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.commentin 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.
I can’t reproduce this. @MelvinBot, do you have any idea how to reproduce the issue?
🤖 Web test steps verification results: ✅ pass
I couldn't reproduce it either. I drove the exact 5 steps on dev NewDot web against a fresh workspace expense, six times with different description values, and the Description row on the money request view showed the new text immediately on landing back every single time — no delay, no stale text.
| Step | Status |
|---|---|
Set description to "Alpha one" on an expense with no descriptionRow showed "Alpha one" immediately, not blank.![]() |
✅ |
Change "Alpha one" → "Beta two"Row showed "Beta two" immediately. Report thread logged "New description is Beta two (previously Alpha one)".![]() |
✅ |
Change to "*bold* text" (markdown)Row rendered the bolded text immediately.![]() |
✅ |
Change same words to "_bold_ text" (different emphasis style)Row switched from bold to italic immediately — no stale text or stale styling.![]() |
✅ |
Multi-line description ("line one" / blank / "line two")Couldn't enter it — a bare Enter in the composer submits the form instead of inserting a newline, so only "line one" was saved (and it showed immediately). Tooling limitation, not a product finding.![]() |
⚠️ |
Same edit with the expense opened from the Reports tabRow showed "Gamma three" immediately.![]() |
✅ |
How I'd try to reproduce it
There is exactly one code path that produces this symptom with no network request at all, and it's input-dependent — which would explain why neither of us hits it with ordinary text. DynamicIOURequestStepDescription.tsx:142 bails out silently when the submitted value equals the current one:
const newComment = value.moneyRequestComment.trim();
if (newComment === currentDescriptionInMarkdown) { setIsSaved(true); armNavigateBack(); return; }
The right-hand side is not the raw stored value — it's Parser.htmlToMarkdown(transaction.comment.comment) (:94-99), while the stored value is server-rendered HTML. So any edit where markdown → HTML → markdown isn't the identity compares equal to a genuinely different input, and you get step 5 exactly: back on the expense, old text, no pending state, no request.
Three inputs worth trying, in order:
- Underscores or asterisks inside a word. Save
some_var_name, then edit it back tosome_var_name. The stored HTML issome<em>var</em>name, whose markdown issome*var*name, so the field keeps showing the italicized version and your retype appears to do nothing. - Whitespace-only differences.
newCommentis.trim()ed but the stored value may not be — an edit that only adds or removes leading/trailing space no-ops. - A description that was pasted with rich text, a link, or a line break, then edited. Same round-trip asymmetry, and the Enter-submits quirk above means multi-line descriptions mostly arrive by paste.
Also worth asking Kel-Expensify directly: was the description being edited plain text, and was the expense an ordinary manual expense or a card/scanned one?
The one check that settles it
If anyone can hit it, open DevTools first and save the edit:
- No
UpdateMoneyRequestDescriptionrequest fires → the silent no-op above. Fix is in the step page: compare against the raw stored value, or round-trip the new value the same way before comparing. - Request fires and the field is still stale → run
Onyx.get('transactions_<id>').comment.commentin the console. New value means a render bug; old value means the backend response is echoing the old comment, and the fix is outside this repo.
Without that, any fix is a guess — and the body still says "Reproducible in staging?: Needs reproduction (Unable to reproduce)".
Separately, the missing Search hash in the Description, Merchant and Date step pages is still a real defect, but it only affects the Search table row, not this view. It should be its own issue.
Next Steps: Reply with @MelvinBot <your feedback> to refine this analysis.
:sos: C+ Help Wanted
Proposal
What is the root cause of that problem?
The description save is optimistic and correct — the value is being overwritten by a redundant OpenReport read, not read stale. I traced every link:
- The save unconditionally merges the new
commentinto the livetransactions_<id>key —UpdateMoneyRequest.ts:2174-2186. No gate, no snapshot indirection. - The field the user is staring at is the description row in
MoneyRequestView, and it reads that same live key:const transaction = updatedTransaction ?? onyxTransactionatMoneyRequestView.tsx:237. In the normal Reports/Expenses and Inbox flowsupdatedTransactionis undefined (it's only passed by the merge/duplicate pages), so this is a live read in every path that matters here.
So the write lands and the read is live. The only thing left that fits "reverts to old text, sometimes heals a few seconds later, sometimes not until refresh, can't reproduce reliably" is a concurrent read clobbering the write — a race.
Here's what fires that read, and why it only happens from the Search tab:
- On save, the dynamic editor pops via
useNavigateBackOnSave/index.ts:40—Navigation.goBack(backTo, {shouldSkipFocusRestore: true}). - Focus returns to the underlying Search expense RHP, which re-runs
ReportFetchHandler. ItsfetchReport()effect listsroutein its deps and re-issuesOpenReporton that change —ReportFetchHandler.tsx:524-533. On the SEARCH_REPORT route there's also aforceReplaceremount to the expense-report RHP, gated on the Search-onlyshouldReplaceWithExpenseReportRHP—:98and:512-522, whose own comment notes it deliberately re-runs "if focus returns to this screen." Either way, a freshOpenReportgoes out. That's the "page reloads." OpenReportis a separate async command fromUpdateMoneyRequestDescription. Its response carriestransactions_<id>with the pre-edit comment; when it lands after the optimistic merge, the field reverts to the old text. When the description command's own response (or the Pusher update) lands later, it heals — "appears a few seconds later"; if the read wins, it sticks until a refresh. Which one wins is pure ordering, which is exactly why QA marked it "unable to reproduce."
The Inbox flow is immune because it renders the normal report screen, not SEARCH_REPORT — shouldReplaceWithExpenseReportRHP is never set, the back-nav is a plain pop, no OpenReport is re-issued, and nothing races the write. That's the axis that differs between repro and non-repro.
One boundary I want to be honest about: whether OpenReport's server response literally echoes the old comment is a Web-Expensify detail I can't read from this repo. But the App-side trigger — firing a redundant read at all on an inline-edit return — is entirely client-side, and so is the fix.
What changes do you think we should make in order to solve the problem?
Fix layer: data-fetch / navigation in ReportFetchHandler. The write is already right; the bug is a read the App shouldn't be firing.
Don't issue a fresh OpenReport (or a forceReplace remount) when we return to an already-loaded report because a dynamic sub-step was popped. A popped inline editor is not a new link click.
// in the fetchReport() effect (ReportFetchHandler.tsx:524-533)
// skip refetch when the same report is already loaded and we merely popped a pushed sub-route
if (reportIDFromRoute === prevReportIDRef.current && reportLoadingState.hasOnceLoadedReportActions) {
return;
}
fetchReport();
and bail the forceReplace effect on focus-return when the report we'd replace to is the one already shown.
This is race-free: with no redundant read on the return path, there is no response that can arrive after the optimistic merge, so the value can never be clobbered regardless of command ordering. Contrast with the tempting narrowing fix (re-dispatch the description write after navigation settles) — that still loses whenever the read response happens to land last.
Verification, stated plainly: I could not run a live browser repro this session (no browser control, and the issue is marked unreproducible), so this is code-traced, not screen-captured. There is currently no test asserting the optimistic comment survives a concurrent read — UpdateMoneyRequestTest.ts only asserts a violation survives. I'd add a unit test that dispatches updateMoneyRequestDescription, then applies an OpenReport-shaped MERGE to transactions_<id> echoing the old comment, and asserts the description stays the new value — that fails on main and passes once the redundant read is gated.
What alternative solutions did you explore? (Optional)
- Protect the field with
pendingFieldsinstead of suppressing the read — keeppendingFields.commentfrom the write and make the read-response apply skip fields with a pending action. Rejected as the primary fix: OnyxMERGEdoesn't honorpendingFieldsautomatically, so it needs a broader change to the read-apply path. Worth doing defensively, but it's a bigger blast radius than gating one refetch. - Re-dispatch the description write after navigation settles — rejected: race-narrowing, not race-free; it still reverts whenever the
OpenReportresponse lands last. - The missing Search-snapshot
hashin the migrated step pages, discussed at length above, is a real but separate defect whose outcome is a stale table row, not the stale detail field in this repro — out of scope here.
🚨 Edited by proposal-police: This proposal was edited at 2026-10-07 02:56:48 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user opens an expense from the Reports/Expenses (Search) tab, opens the full-page Description editor, types a new description and saves, the Description field snaps back to the old value. Sometimes the correct value appears a few seconds later; other times it never appears until the page is refreshed or the expense is reopened from the Inbox. As @linhvovan29546 reproduced, it happens after a brief network interruption and is not specific to Description: any field saved while the reconnect sync is in flight can revert.
What is the root cause of that problem?
Retracting my earlier root cause. The Description row in the expense view reads the live transactions_<id> key, not the Search snapshot (MoneyRequestView.tsx#L241-L242), and the save writes the new comment there optimistically. Passing currentSearchHash cannot change what that row shows (Onyx also mirrors every live write into cached snapshots on its own, Onyx.update → updateSnapshots), so the missing hash is not this bug.
The real cause is a READ that was already in flight when Save was pressed.
- Only WRITE responses are staged until the sequential queue flushes; READ responses are written to Onyx the moment they arrive (OnyxUpdates.ts#L69).
API.readwaits for pending writes before it sends a READ (API/index.ts#L170-L174, #L194), which protects writes made before the READ. Nothing protects a write made after the READ left: the server answered that READ from state older than the edit, and its response is applied over the edit.- The trigger is the post-reconnect sync. After a brief network drop, ReconnectApp's response fires
SearchForTodos(LoadPostDataForOpenOrReconnect.ts#L17 → App.ts#L513), a READ whose response carries the to-do reports and their transactions. Saving during that round trip gives the two reported outcomes:- the READ response lands before the save's response: the field flips back while
pendingFields.commentis still set, and heals when the save's response is flushed ("appears a few seconds later"); - the READ response lands after the save's response was flushed: the save's
successDataonly clearspendingFields(UpdateMoneyRequest.ts#L2302-L2310), so nothing re-asserts the comment and the old value stays until a refresh ("never appears").
- the READ response lands before the save's response: the field flips back while
- Nothing here is specific to Description. Merchant, date, category, amount and workspace edits all go through the same optimistic write and meet the same in-flight response, which is why a Description-only fix is too narrow.
Measured on main (2b5a59c, web, real backend; the SearchForTodos response was held with a fetch tap so the order is deterministic):
READ held 15 s SearchForTodos sent 2.4 s → Save 2.9 s → save response 3.8 s → comment "run B" confirmed 5.6 s
→ stale response 18.6 s → comment back to "run A" at 19.7 s, stays until reload (never appears)
READ held 350 ms SearchForTodos sent 2.8 s → Save 3.5 s → stale response 3.8 s → comment "run D" (pending)
→ save response 4.2 s → comment "run E" (appears later)
What changes do you think we should make in order to solve the problem?
Close the gap at the one place every response is applied, SaveResponseInOnyx, with the mirror image of waitForWrites: a READ must not be applied over a write that was prepared while it was in flight, just as it is not sent while a write is pending. Scoped by Onyx key, so unrelated READs keep applying immediately.
makeRequest.prepareRequest— when a WRITE is prepared, record itsrequestIndexand the Onyx keys itsoptimisticDatatouches (collection updates expanded to their member keys). Records are only kept while a READ is in flight and are released as soon as no in-flight READ predates them.makeRequest.processRequest— stamp each READ with the newest WRITE index at dispatch time (afterwaitForWrites, so a write the READ waited for is not counted against it).SaveResponseInOnyx— for a successful READ response, if a WRITE prepared after the READ's dispatch touched any key in the response'sonyxData, apply nothing from this response (itssuccessData/finallyDatatravel with the retry) and re-issue the READ once the queue is idle. Bounded to two re-sends, after which the response is applied as-is so a stream of writes can never starve a READ. Sign-in READs are exempt (writes can be waiting on them). WRITE and side-effect responses are untouched.
// SaveResponseInOnyx, before building responseToApply
if (isRead && response.jsonCode === 200 && !isSignInRead && doesReadResponseOverwriteNewerWrite(request, onyxData)) {
if (consumeStaleReadRetry(request)) {
waitForSequentialQueueIdle().then(() => processRequest(request, READ));
return Promise.resolve(response); // nothing from this response reaches Onyx
}
}
This covers both orderings (the retried READ is sent after the write finished, so its data includes the edit), every field, and every READ, with no change to update-ID handling, queue pausing or the WRITE path.
Verification:
- New
tests/unit/StaleReadResponseTest.tsdrives realAPI.read/API.writethrough the middleware with held responses: READ response after a newer write (fast and slow orderings) is not applied and the READ is re-sent; a READ touching unrelated keys applies as before; a READ sent after the write is not held; the retry budget is honoured. 3 of 5 fail onmain, 5 pass with the change. - Neighbouring suites still pass:
MiddlewareTest,APITest,SequentialQueueTest,SequentialQueueReadGateTest,OnyxUpdatesTest,PaginationMiddlewareTest,ReauthenticationMiddlewareTest,MiddlewareRegistrationTest(171 tests). - Web, same scenario as above with the change: stale response at 18.4 s not applied, comment stays "run C",
SearchForTodosre-sent at 18.4 s and its fresh response applied; 350 ms case: no flicker, re-sent once the save finished.
What alternative solutions did you explore? (Optional)
- Pass
currentSearchHashfrom the step pages (my original proposal): wrong surface, see above. Still worth threading for the Search row, but as a separate issue. - Re-assert the edited field in
successData, or skip server values for keys inpendingFields: one field at a time, and in the slow orderingpendingFieldsis already cleared when the stale response lands. - Drop and re-send every in-flight READ whenever any WRITE is prepared (request-level, no key check): closes the same gap but discards unrelated READs after every
OpenReport/AddComment— Search results andGetOlderActionspages would be re-fetched on every navigation. Key scoping keeps the extra round trip to the overlapping case only. - Filter stale fields across READ, catch-up and queued WRITE responses in the Onyx apply pipeline: broader coverage, but it rewrites the apply path and the queued-flush path. The reproduced path is the READ one; incremental ReconnectApp/GetMissingOnyxMessages responses can only produce a flicker (the save's own response lands after them and restores the value) and cannot be dropped because they close the update-ID gap, so they are deliberately out of scope here and can follow separately if wanted.
- Suppress the refetch when returning from the editor:
OpenReportis a WRITE, so its response is queued and applied in order after the save; it is not what overwrites the field.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When you open an expense from the Reports or Expenses tab (Search), edit its Description and Save, the Description on the expense reverts to the old value. It sometimes updates to the new text a few seconds later, and sometimes stays stale until the page is refreshed or the expense is reopened from the Inbox.
What is the root cause of that problem?
The Reports/Expenses tab does not render the expense from the live transactions_<id> collection. It renders it from the Search snapshot (snapshot_<hash>) and only falls back to the live collection when the snapshot has nothing for that report:
// Get transaction from search snapshot if not available in main collections
const transaction = Object.values(allReportTransactions).at(0) ?? snapshotTransaction;
https://github.com/Expensify/App/blob/e75076263778a4035e3dbe96d66bee12f7a573c5/src/pages/Search/SearchMoneyRequestReportPage.tsx#L162-L183
Saving the Description calls updateMoneyRequestDescription, which writes the new comment optimistically to transactions_<id>. The write that patches the snapshot is a separate step, and it is explicitly there because the snapshot is the render source:
Search result rows render from snapshot data, so TRANSACTION writes alone do not refresh the list.
https://github.com/Expensify/App/blob/e75076263778a4035e3dbe96d66bee12f7a573c5/src/libs/actions/IOU/UpdateMoneyRequest.ts#L120-L166
That snapshot write is gated behind if (hash):
https://github.com/Expensify/App/blob/e75076263778a4035e3dbe96d66bee12f7a573c5/src/libs/actions/IOU/UpdateMoneyRequest.ts#L2418-L2433
and the Description step page never passes hash into the update call:
https://github.com/Expensify/App/blob/e75076263778a4035e3dbe96d66bee12f7a573c5/src/pages/iou/request/step/DynamicIOURequestStepDescription.tsx#L155-L177
So the snapshot keeps the pre-edit description. The Reports/Expenses surface keeps sourcing the expense from that stale snapshot, which is why the field shows the old value right after Save. It only self-heals when something rewrites the snapshot from the server - a later search() refetch (the "few seconds later") or a full refresh - or when you open the expense from the Inbox, which reads the live transactions_<id> value directly.
This is a regression from Migrate money request merchant, description and date steps to dynamic. It moved Description, Merchant and Date to the dynamic step pages and each dropped the hash argument. The sibling steps that were not in that PR still thread it correctly:
| Step | Passes hash? |
|
|---|---|---|
| Description | No | https://github.com/Expensify/App/blob/e75076263778a4035e3dbe96d66bee12f7a573c5/src/pages/iou/request/step/DynamicIOURequestStepDescription.tsx#L155 |
| Merchant | No | https://github.com/Expensify/App/blob/e75076263778a4035e3dbe96d66bee12f7a573c5/src/pages/iou/request/step/DynamicIOURequestStepMerchant.tsx#L151 |
| Date | No | https://github.com/Expensify/App/blob/e75076263778a4035e3dbe96d66bee12f7a573c5/src/pages/iou/request/step/DynamicIOURequestStepDate.tsx#L136 |
| Category | Yes | https://github.com/Expensify/App/blob/e75076263778a4035e3dbe96d66bee12f7a573c5/src/pages/iou/request/step/DynamicIOURequestStepCategory.tsx#L207 |
| Tag | Yes | https://github.com/Expensify/App/blob/e75076263778a4035e3dbe96d66bee12f7a573c5/src/pages/iou/request/step/DynamicIOURequestStepTag.tsx#L190 |
What changes do you think we should make in order to solve the problem?
- In
DynamicIOURequestStepDescription.tsxread the current Search hash and pass it into the update call, mirroring whatDynamicIOURequestStepCategory.tsxalready does at L113 and L207:
const {currentSearchHash} = useSearchQueryContext();
and in the updateMoneyRequestDescription({...}) call:
hash: currentSearchHash,
currentSearchHashfalls back to-1when the edit is not happening on Search:
https://github.com/Expensify/App/blob/e75076263778a4035e3dbe96d66bee12f7a573c5/src/components/Search/SearchQueryProvider.tsx#L60
Pass undefined in that case so we never mint a bogus snapshot_-1 key when editing from the Inbox:
hash: currentSearchHash === CONST.DEFAULT_NUMBER_ID ? undefined : currentSearchHash,
(guard written against whatever sentinel -1 maps to; the intent is "only pass a real Search hash")
-
Apply the same change to
DynamicIOURequestStepMerchant.tsxandDynamicIOURequestStepDate.tsx, which regressed in the same PR and produce the same stale-field behavior for Merchant and Date. -
Add a regression test asserting that a Description edit dispatched with a
hashwrites the new comment tosnapshot_<hash>, so the next step migration can't silently drop it again.
Note for the reviewer: the snapshot write is also nested inside a group-policy, non-invoice gate (L2344-L2365), so personal-policy and self-DM expenses stay unpatched even with the hash. Widening that gate is worth a follow-up but is a bigger change; the three step-page fixes cover the reported group-workspace repro.
What alternative solutions did you explore? (Optional)
- Make the Reports/Expenses expense view prefer the live
transactions_<id>value over the snapshot when it is newer. Rejected: the snapshot is the intended render source for the Search surface, and reading a different source for the detail view than for the list row would desync the two and defeat the reason the snapshot layer exists. - Trigger a
search()refetch on Save. Rejected: this is the current slow self-heal path - a network round-trip for a value we can patch optimistically. It also would not work offline, whereas the snapshot patch does. - Read
currentSearchHashinsideupdateMoneyRequestDescriptionitself instead of threading it from the page. Rejected: the action layer is deliberately hook-free and the established convention is to passhashfrom the page, which is exactly what Category and Tag do.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When an expense is opened from the Reports or Expenses tab and its description is edited through the full-page editor, the saved text is not reflected after clicking Save: the Description still shows the old value. The new value sometimes shows up a few seconds later, and sometimes only after the page is refreshed or the expense is reopened from the Inbox.
(The reproduction steps in the issue body describe the description-save problem addressed here; the issue title appears to have been carried over from an earlier, unrelated report — #99205 has the identical title.)
What is the root cause of that problem?
Everything shown in the Search context (the Reports and Expenses tabs) renders from the search snapshot in Onyx, not from the live collections. The app's snapshot-aware useOnyx redirects reads of transaction keys to snapshot_<currentSearchHash> while inside the Search scope:
https://github.com/Expensify/App/blob/0eaa96e8cd288fe4c51017a3d3f4a4c24c16295b/src/hooks/useOnyx.ts#L75-L100
The expense report page opened from Search likewise falls back to the snapshot copy of the transaction whenever the live collection does not have it yet:
https://github.com/Expensify/App/blob/0eaa96e8cd288fe4c51017a3d3f4a4c24c16295b/src/pages/Search/SearchMoneyRequestReportPage.tsx#L162-L183
https://github.com/Expensify/App/blob/0eaa96e8cd288fe4c51017a3d3f4a4c24c16295b/src/pages/Search/SearchMoneyRequestReportPage.tsx#L270-L271
Because of that, an expense edit made while in the Search context must also update the snapshot. That is exactly what getSearchSnapshotUpdates is for — its own comment says "Search result rows render from snapshot data, so TRANSACTION writes alone do not refresh the list" — but it only produces writes when the caller passes the current search hash, and silently returns nothing otherwise:
https://github.com/Expensify/App/blob/0eaa96e8cd288fe4c51017a3d3f4a4c24c16295b/src/libs/actions/IOU/UpdateMoneyRequest.ts#L121-L143
The full-page description editor never passes that hash. DynamicIOURequestStepDescription calls updateMoneyRequestDescription without the hash argument, even though the function accepts it:
https://github.com/Expensify/App/blob/0eaa96e8cd288fe4c51017a3d3f4a4c24c16295b/src/pages/iou/request/step/DynamicIOURequestStepDescription.tsx#L155-L177
So the optimistic update lands only on the live transactions_ key, and the snapshot copy keeps the old description. The surfaces that render from the snapshot keep showing the stale text until the snapshot is refreshed from the server — which matches "the new description appears a few seconds later" — or never, until the page is reloaded. Opening the same expense from the Inbox shows the new text because the Inbox renders live data, which also matches the report.
The sibling edit paths do this correctly, which is why only this flow is broken. The category and tag full-page editors pass the hash from the search query context:
https://github.com/Expensify/App/blob/0eaa96e8cd288fe4c51017a3d3f4a4c24c16295b/src/pages/iou/request/step/DynamicIOURequestStepCategory.tsx#L113
https://github.com/Expensify/App/blob/0eaa96e8cd288fe4c51017a3d3f4a4c24c16295b/src/pages/iou/request/step/DynamicIOURequestStepCategory.tsx#L207
And the inline description edit in the search table passes the hash as well:
https://github.com/Expensify/App/blob/0eaa96e8cd288fe4c51017a3d3f4a4c24c16295b/src/libs/actions/TransactionInlineEdit.ts#L297-L307
What changes do you think we should make in order to solve the problem?
In DynamicIOURequestStepDescription, read currentSearchHash from useSearchQueryContext() and pass it as the hash argument to updateMoneyRequestDescription — the same thing the category and tag steps already do. With the hash present, the save merges the updated transaction into the search snapshot optimistically (with the matching success and failure writes already built by getSearchSnapshotUpdates), so the description updates immediately everywhere the Search view renders it, works offline, and rolls back on failure.
Two related gaps belong with this fix:
- In
getUpdateMoneyRequestParams, the snapshot write currently runs only inside the violations-recompute block, which is gated to group policies. An expense on a personal policy would still skip the snapshot update even with the hash passed. The snapshot write should run whenever a hash and an updated transaction are available, the waygetUpdateTrackExpenseParamsalready does it unconditionally:
https://github.com/Expensify/App/blob/0eaa96e8cd288fe4c51017a3d3f4a4c24c16295b/src/libs/actions/IOU/UpdateMoneyRequest.ts#L2344-L2348
https://github.com/Expensify/App/blob/0eaa96e8cd288fe4c51017a3d3f4a4c24c16295b/src/libs/actions/IOU/UpdateMoneyRequest.ts#L2418-L2433
https://github.com/Expensify/App/blob/0eaa96e8cd288fe4c51017a3d3f4a4c24c16295b/src/libs/actions/IOU/UpdateMoneyRequest.ts#L2733-L2748
- The merchant and date full-page editors, which were migrated to dynamic routes together with the description step, omit the hash in the same way and can be fixed identically.
Compare branch: https://github.com/Expensify/App/compare/main...wildan-m:App:wildan/101937-description-search-snapshot?expand=1
What alternative solutions did you explore? (Optional)
Re-running the search (or re-fetching the snapshot) after a save would also surface the new text, but it needs a network round-trip, does not work offline, and reloads the whole list — the app's established offline-first pattern for this situation is the optimistic snapshot write that the other edit paths already use.
Another option is to make the snapshot-aware read layer overlay live optimistic transaction data on top of snapshot data. That changes the read path for every consumer of search data and duplicates, at the read layer, what getSearchSnapshotUpdates already implements at the write layer, so it was rejected in favor of fixing the write path.
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
🤖 ProposalPolice™ is tracking duplicate proposals for this issue using an OpenAI Conversation. This comment stores that Conversation's ID and can be safely ignored.
Proposal updated — added compare branch with implementation.
Proposal
What is the root cause of that problem?
When a user opens an expense from Reports or Expenses, saves a new Description, and returns to that expense, the Description field still shows the old text. The new text only appears after a later Search load, or after a refresh / opening the expense from the Inbox.
Reports and Expenses are the Search surface. Query writes go through setFilterQueryParams in useUpdateFilterQuery. That function always marks the query as a refinement so SearchPage holds the previous results while it loads, then rewrites route q with Navigation.setParams:
https://github.com/Expensify/App/blob/1e3ca2f379aca3c29a5900f6945996397702c43c/src/components/Search/hooks/useUpdateFilterQuery.tsx#L16-L68
The Navigation.setParams write is the page reload in the report. The refinement hold keeps the previous Search rows, which still contain the old Description. That is why the field does not show the saved text immediately, and why it sometimes catches up a few seconds later when Search replaces those rows.
What changes do you think we should make in order to solve the problem?
- In
setFilterQueryParamsinsideuseUpdateFilterQuery.tsx, drop themarkQueryAsRefinement(queryString)call that runs before the route update.
https://github.com/Expensify/App/blob/1e3ca2f379aca3c29a5900f6945996397702c43c/src/components/Search/hooks/useUpdateFilterQuery.tsx#L16-L68
Today every query write tells SearchPage to keep the last result set on screen. After Save, that set still has the old Description. Keep building the query string and updating params, but do not mark it as a refinement:
if (!queryString) {
return;
}
const shouldResetSearchKey = !!values.type && values.type !== searchAdvancedFiltersForm.type;
Navigation.setParams({q: queryString, rawQuery: undefined, ...(shouldResetSearchKey && {searchKey: getSearchKeyForQuery(buildSearchQueryJSON(queryString))})});
Without that hold, the Search-backed expense does not keep painting the pre-save Description after q changes. Filter apply in SearchAdvancedFiltersProvider already uses this same setFilterQueryParams path, so both Reports and Expenses pick up the change.
https://github.com/Expensify/App/blob/1e3ca2f379aca3c29a5900f6945996397702c43c/src/pages/Search/SearchAdvancedFiltersProvider.tsx#L44-L94
What alternative solutions did you explore? (Optional)
Refetching the whole Search list after every Description save. That would eventually show the new text, but it reloads every row and waits on the network instead of simply not holding the previous results.
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.




