Repository navigation
Description
If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.
Version Number: v9.5.13-3
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/79209904/folder/13176723/41237037/1871928616
Email or phone of affected tester (no customers): gd868gd@gmail.com and gd868gd+1@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Google Pixel 7a / Android 17
App Component: Chat Report View
Action Performed:
Preconditions:
- User A is the owner and approver of Workspace A.
- User B is a member of Workspace A.
- Open the Expensify Web App and log in as User B
- User B goes to Inbox and opens the workspace chat
- User B creates and submits an expense in the workspace chat
- User B sends a long message (or several messages, or an attachment) in the same chat (to move the submitted expense to the top of the chat)
- Open the Expensify App and log in as User A
- User A goes to Inbox and opens the workspace chat (the chat will be automatically scrolled to the expense that needs approval)
- User A types a message in the composer and sends it
Expected Result:
The message should not reappear in the composer after being sent to the workspace chat.
Actual Result:
The already sent message reappears in the message composer after the chat is scrolled down, and the green "Approve" button appears at the top of the screen.
Note: This happens only the first time after opening the chat. To reproduce the issue a second time, the user needs to go back to the Inbox and reopen the chat.
Workaround:
Unknown
Platforms:
- Android: App
- Android: mWeb Chrome
- iOS: App
- iOS: mWeb Safari
- iOS: mWeb Chrome
- Windows: Chrome
- MacOS: Chrome Safari
Screenshots/Videos
To be added by Applause Leads
Bug7289460_1792298474910.Expensify_26w42_Message_Reappear.mp4
Applause Internal Information
Exported by: Chandana Kiran
Bug ID: 7289460
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022112186732253821478
- Upwork Job ID: 2112186732253821478
- Last Price Increase: 2026-10-19
Issue Owner
Current Issue Owner: @mallenexpensifyMetadata
Metadata
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
applause-bot commentedon Oct 19, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/71ec8717d9f66353f4e11b0d7e644b3bb73d4b1d42cee789e95c22b5903f9401
https://platform.applause.com/services/links/v1/external/6259f09d28af5342048e54c7d0bc591f8a1acde129801b645bffcfe8b2b0c143
MelvinBot commentedon Oct 19, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On Android, an approver opens a workspace chat that auto-scrolls to an unapproved expense and sends a message. The chat then jumps to the bottom, and the sent text comes back in the composer. It only happens on the first send after you open the chat.
What is the root cause of that problem?
Sending the first message rebuilds the whole report screen, composer included. The new composer reads its starting text from the saved draft before the 1-second debounced clear has emptied it.
reportActionID(the expense) to the route. That's why the chat lands on the expense.LinkedActionNotFoundGuardreturns a different tree depending on that param: barechildrenwhen it's empty, orchildrenwrapped in a keyed<LinkedActionNotFoundGate>when it's set. It wraps the header, the action list and the footer/composer (ReportScreen.tsx:129-164).useReportActionsNewActionLiveTail.ts:106-124). When that load finishes, it clears the param withsetParams({reportActionID: ''})(L167-L188). The guard switches branches, so React unmounts and remounts everything under it. That explains the jump to the bottom and the freshly rendered header and Approve button. It's first-time-only because the param is gone after that.ComposerProvidertakes its starting text fromREPORT_DRAFT_COMMENTonce, when it mounts (ComposerProvider.tsx:64-68). Sending doesn't clear the draft right away.onClearcallsupdateComment('', true), which goes through the 1-second debounced save (ComposerWithSuggestions.tsx:985-992). If the remount happens inside that window, the composer starts with the sent text.What changes do you think we should make in order to solve the problem?
LinkedActionNotFoundGuardthe same shape whether or not a linked action is set. Render the gate as a sibling that returnsnull, and renderchildrenin the same position every time. Clearing the linked action should then never remount the header, list or composer. This also keeps focus and other local state.What alternative solutions did you explore? (Optional)
Only doing step 2. It fixes this symptom, but the screen would still remount and lose state on the first send.
Open questions (not verified)
'', andSilentCommentUpdatershould then clear the composer. It skips that sync only whenisCommentPendingSavedis true. My best guess is that the Android text input firesonChangeTextwhen it mounts with the stale text. That would queue a new save, block the sync, and write the sent text back. I haven't confirmed this on a device.reportActionID, so I can't name a single offending PR.Possibly related: Android - Compose box - Draft message input reappears after clearing and navigating. It's also a stale draft from a debounced save, but in the edit composer, with a different trigger.
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/104358)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run
melvin-bot commentedon Oct 19, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @nyomanjyotisa (
External)[-]Android-Chat-Message reappear in composer when sent to chat with unapproved expense[/-][+][$175] Android-Chat-Message reappear in composer when sent to chat with unapproved expense[/+]melvin-bot commentedon Oct 19, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022112186732253821478
j3ffffff commentedon Oct 19, 2026
janiya2 commentedon Oct 19, 2026
Contributor details
Your Expensify account email: janithad2@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/janithad
Proposal
Please re-state the problem that we are trying to solve in this issue.
On Android, when an approver opens a workspace chat from Inbox that has an unapproved expense, the chat auto-scrolls to the linked expense action. When the user types a message in the composer and sends it, the chat jumps to the bottom and the sent message incorrectly reappears in the composer.
What is the root cause of that problem?
This issue is caused by a root-level component hierarchy change in
LinkedActionNotFoundGuardcombined with debounced draft saving and Android's asynchronousTextInputevent cycle:Root-Level Unmount/Remount Triggered by Route Param Clearing:
reportActionIDis passed in route params to focus on that expense.ReportScreen.tsx:129-164,<LinkedActionNotFoundGuard>wraps the entire report view (ReportDragAndDropProvider,ReportHeader,ReportActionsList, andReportFooter/ComposerProvider).LinkedActionNotFoundGuard.tsx:33-44:useReportActionsNewActionLiveTail.ts:167-188jumps to newest messages and clears the param viaNavigation.setParams({reportActionID: ''}).reportActionIDFromRoutebecomes falsy,LinkedActionNotFoundGuardswitches React branches from<LinkedActionNotFoundGate>{children}</LinkedActionNotFoundGate>to bare{children}.ReportHeader,ReportActionsList,ComposerProvider, andTextInput) and mounting a new tree from scratch.Debounced Draft Persistence in Onyx:
ComposerWithSuggestions.tsx:985-993calls:shouldDebounceSaveComment = truesends the clear throughdebouncedSaveComment(''), which waits1000msbefore committing''to OnyxREPORT_DRAFT_COMMENT.reportActionIDclearing, the newly mountedComposerProvider(ComposerProvider.tsx:64-68) reads its initial text fromdraftCommentin Onyx, which still holds the sent message!Android Native TextInput Event Cycle:
ReactEditTextmounts asynchronously with the initial draft text and emits a nativeonChangeTextevent back to the JS thread during attachment/layout.updateCommentwith the stale text, re-scheduling a debounced save and permanently restoring the sent message inside the composer.Historically,
commit 25d3bb4cremoved<FullPageNotFoundView>fromLinkedActionNotFoundGatebecause deleted linked actions now auto-recover viauseAutoNavigateForDeletedLinkedAction. Therefore,LinkedActionNotFoundGatehas no UI representation whatsoever (it returns barechildren), and wrappingchildreninside it only serves to destabilize the component tree wheneverreportActionIDtransitions between defined and undefined.What changes do you think we should make in order to solve the problem?
1. Decouple
childrenfromLinkedActionNotFoundGateinsrc/pages/inbox/LinkedActionNotFoundGuard.tsx:Render
LinkedActionNotFoundGateas a headless sibling rather than wrappingchildren. This keepschildrenat the exact same depth in the React tree whetherreportActionIDFromRouteis defined or undefined, completely eliminating the root unmount/remount:2. Synchronously clear draft comments on send in
src/pages/inbox/report/ReportActionCompose/ComposerWithSuggestions.tsx:When a message is submitted and cleared, there is no need to debounce saving
''for 1000ms. Cancel any pending keystroke debounces and immediately clear the draft in Onyx so that Onyx never holds stale message text:What alternative solutions did you explore? (Optional)
ComposerWithSuggestions: While this prevents stale drafts from being reloaded, it leaves the unnecessary unmount/remount of the entireReportScreenactive. The unmount causes header flickering, keyboard focus drops, and re-renders the entire message list on the first message sent. Stabilizing the tree inLinkedActionNotFoundGuardsolves the root architectural cause.reportActionIDas a prop intoLinkedActionNotFoundGatewithout keys: Retainingkey={reportActionIDFromRoute}on the headless gate is superior because it cleanly resets gate-specific local states (wasEverVisible,hasSeenLoadingCycle) whenever a new linked action route is opened.Tests
Manual Test Steps:
Preconditions:
Offline / Draft Persistence Test:
Regression Tests:
/r/:reportID/:reportActionID): verify the action is highlighted and focused correctly.melvin-bot commentedon Oct 19, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
sijo0218 commentedon Oct 19, 2026
Contributor details
Your Expensify account email: sijo0218@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~011091133bbb09cd1c
Proposal
Please re-state the problem that we are trying to solve in this issue.
On Android, when an approver opens a workspace chat that was automatically scrolled to an unapproved expense via a linked action and sends a message, the sent message unexpectedly reappears in the message composer immediately after the chat scrolls down and the green "Approve" button renders.
What is the root cause of that problem?
This is caused by a race condition between debounced draft clearing, route parameter clearing, and Android-specific component mount behavior:
In
src/pages/inbox/report/ReportActionCompose/ComposerWithSuggestions.tsx:985-992:When a message is sent,
onClearinvokesupdateComment('', true), wheretrue(shouldDebounce) delays the Onyx draft write by 1 second (CONST.TIMING.DRAFT_SAVE_DEBOUNCE_TIME). During this 1-second window,ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENTstill holds the sent message text.Live-Tail Jump Clears Route Param:
When the user's sent message arrives,
useReportActionsNewActionLiveTail.tsdetectsshouldJumpToLiveTail = !!linkedReportActionID(true). Once the report actions load,clearLinkedActionParam()callsnavigation.setParams({reportActionID: ''}), changingreportActionIDFromRoutefrom the expense action ID to an empty string''.Subtree Remount via Key Change:
In
LinkedActionNotFoundGuard, changingreportActionIDFromRoutefrom a valid ID to''alters the React tree shape (removing<LinkedActionNotFoundGate key={reportActionIDFromRoute}>), causing React to unmount and remount the composer subtree.Android SilentCommentUpdater Restores Stale Draft:
In
src/pages/inbox/report/ReportActionCompose/SilentCommentUpdater/index.android.tsx:On remount, the empty-dependency
useEffectfires and passes the OnyxcommenttoupdateComment. Because the 1-second debounce has not yet cleared Onyx,commentis still the sent message, immediately restoring the text into the composer. The non-Android implementation (index.tsx) guards against this with!isCommentPendingSaved.current, but the Android implementation was missing this guard entirely.What changes do you think we should make in order to solve the problem?
isCommentPendingSavedin Android Updater:In
src/pages/inbox/report/ReportActionCompose/SilentCommentUpdater/index.android.tsx:Accept
isCommentPendingSavedfromSilentCommentUpdaterPropsand skip restoring the comment if a save/clear is pending:In
src/pages/inbox/report/ReportActionCompose/ComposerWithSuggestions.tsx:990:Change
updateComment('', true)toupdateComment('', false). When a message is actively sent and cleared, there is no reason to debounce the empty string write to Onyx. Writing''immediately eliminates the 1-second stale window at the source.What alternative solutions did you explore? (Optional)
Preventing
LinkedActionNotFoundGuardfrom remounting children when clearingreportActionIDFromRoute. However, fixing the draft clear timing and synchronizing theisCommentPendingSavedcheck between Android and non-Android resolves the root cause cleanly without altering the navigation guard lifecycle.melvin-bot commentedon Oct 19, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
22 remaining items
melvin-bot commentedon Nov 1, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Nov 1, 2026
Payment Summary
Resolving PRs:
Keep the report subtree mounted when the linked action param changes #104381
Reviewer: @nyomanjyotisa owed $175 via NewDot
BugZero Checklist (@mallenexpensify)
melvin-bot commentedon Nov 5, 2026
@mallenexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
melvin-bot commentedon Nov 5, 2026
@mallenexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
melvin-bot commentedon Nov 5, 2026
@mallenexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
mallenexpensify commentedon Nov 5, 2026
Payment Summary
Contributor+: @nyomanjyotisa due $175 via NewDot
trjExpensify commentedon Nov 30, 2026
approved $175 for @nyomanjyotisa