You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$250] Chat is not scrolled to the bottom after creating expense if there is a paid expense in chat #91919
Version Number: 9.3.84-0 Reproducible in staging?: Yes Reproducible in production?: No If this was caught during regression testing, add the test name, ID and link from BrowserStack:https://test-management.browserstack.com/projects/2219752/folder/13177075/test-cases/41237826 Email or phone of affected tester (no customers): N/A Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: iPhone 15 iOS 26.5 App Component: Money Requests
Action Performed:
Sign in to ND
Start a chat with another user you have access to
Send several messages
Send an expense
As another user on secondary device, mark the expense as paid
As the main user, make sure there is no unread messages in the chat, scroll to the top of the chat
Submit one more expense
Expected Result:
The chat is scrolled to the bottom to a new submitted expense
Actual Result:
Chat is not scrolled to the bottom after creating expense if there is a paid expense in chat
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Identify the pull request that introduced this issue and revert it.
When a user creates a new expense in a chat that already contains a paid/settled expense, the code takes a different path than when the existing expense is still active.
With a paid expense, shouldCreateNewMoneyRequestReport returns true because canAddOrDeleteTransactions returns false for settled reports. This causes a newREPORT_PREVIEW action to be inserted into the chat (a brand-new item at index 0 of the inverted list).
Without a paid expense, the existing REPORT_PREVIEW is updated in-place — no new list item is inserted.
Updated REPORT_PREVIEW (no paid expense): findIndex finds the existing action at its measured position → scrollToIndex(index) scrolls to a known, already-laid-out position. ✅
New REPORT_PREVIEW (paid expense): The new action is at index 0 → falls into the else branch calling scrollToBottom() → scrollToIndex({index: 0}). ❌
The problem is that when the user has scrolled to the top of the chat (past 250px), shouldMaintainVisibleContentPosition becomes true, which enablesmaintainVisibleContentPosition on the FlashList. With MVCP enabled and the new REPORT_PREVIEW item just inserted at the head of the inverted list, scrollToIndex({index: 0, animated: false}) on iOS doesn't reliably reach the newly inserted item because the item hasn't been laid out yet and MVCP is actively adjusting content offset to keep the currently visible content stable.
Additionally, REPORT_PREVIEW actions are explicitly excluded from the shouldJumpToLiveTail mechanism (which would otherwise reload the newest page via openReport and reliably scroll to bottom). The backup scroll via useScrollToEndOnNewMessageReceived also doesn't fire because the user's scroll offset exceeds AUTOSCROLL_TO_TOP_THRESHOLD.
What changes do you think we should make in order to solve the problem?
In scrollToBottomForCurrentUserAction, stop unconditionally excluding REPORT_PREVIEW actions from the shouldJumpToLiveTail path. When the user has scrolled away from the bottom (hasNewerActions is true or the scroll offset exceeds the threshold), a new REPORT_PREVIEW should be allowed to use the live-tail jump mechanism (openReport → scroll to bottom → prune) the same way other action types do. This ensures the newest page is properly loaded and the scroll reliably reaches the new item.
Specifically, change the shouldJumpToLiveTail condition to only bypass REPORT_PREVIEW when the user is already near the bottom (i.e., the action is visible in the current window), not when the user is scrolled far away.
What alternative solutions did you explore? (Optional)
Add a requestAnimationFrame delay before scrollToBottom() in the REPORT_PREVIEW handler to let the newly inserted item's layout settle before scrolling. This would be simpler but fragile — it's a timing hack that may not work on all devices.
Temporarily disable maintainVisibleContentPosition before scrolling and re-enable it after. This addresses the MVCP interference directly but is complex to implement cleanly and could cause visual jumps in other scenarios.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.
Please re-state the problem that we are trying to solve in this issue.
After a user scrolls away from the bottom of a 1:1 chat, submitting a new expense should bring the chat back to the newest expense preview. On iOS this fails when the chat already has a paid expense.
What is the root cause of that problem?
Submitting the expense eventually calls notifyNewAction(activeReportID, reportPreviewAction, true) from requestMoney:
That drives scrollToBottomForCurrentUserAction in the report action list. For a REPORT_PREVIEW, the code already delays scrollToIndex(index) when the preview exists at index > 0, but it calls scrollToBottom() immediately when the preview is at index === 0 or is not found yet:
The paid-expense case is the path that exposes this. A paid IOU report cannot accept the new transaction, so the new expense creates a new money request report and a new parent REPORT_PREVIEW at the head of the inverted FlashList. At the moment the current-user action event runs, that new row can be in Onyx but not yet measured/laid out by iOS FlashList. The immediate scrollToIndex(0) is therefore issued too early and does not move the user from the older scroll position.
The normal existing-preview path avoids this because it uses a delayed scrollToIndex(index). The fallback setIsScrollToBottomEnabled(true) does not reliably cover the missed case because it is consumed in the list container onLayout, which does not necessarily fire for a newly inserted row:
What changes do you think we should make in order to solve the problem?
In src/pages/inbox/report/useReportActionsNewActionLiveTail.ts, use the same deferred-scroll strategy for the REPORT_PREVIEWindex <= 0 branch that the index > 0 branch already uses.
Concretely, extract a small helper in the hook, for example deferScrollToBottom(), that clears the floating counter and calls reportScrollManager.scrollToBottom() inside the existing short timeout used for preview scrolling. Then:
keep the existing index > 0scrollToIndex(index) behavior for already-mounted preview rows;
call the deferred bottom-scroll helper for REPORT_PREVIEW when index <= 0;
use the same helper for other current-user actions that insert at the newest position, so the behavior is consistent for newly inserted head rows.
This keeps the existing live-tail/openReport logic intact and only changes the timing of the scroll command in the path where the target row may not be measured yet.
What alternative solutions did you explore? (Optional)
We could route REPORT_PREVIEW through the live-tail openReport -> scroll -> prune path when the user is away from the bottom, but that is heavier than necessary for a local optimistic expense submit.
We could also wire this to onContentSizeChange, but that is broader and would need more guards around pagination and edits. A targeted deferred scroll matches the established pattern already used beside the broken branch.
⚠️@aswin-s Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
Please re-state the problem that we are trying to solve in this issue.
After submitting an expense in a 1:1 chat, the chat does not scroll down to the newly created expense when an already‑paid expense exists in that chat (the view stays where it was instead of jumping to the live tail).
What is the root cause of that problem?
New‑action scrolling is handled in scrollToBottomForCurrentUserAction. When the user is scrolled away from the live tail (hasNewerActions === true), the handler normally performs a "live‑tail jump" (openReport → scroll to bottom → prune) so the user lands on the freshly created action. That jump is intentionally skipped for every REPORT_PREVIEW action:
The exclusion exists to preserve the "auto‑merge" behavior added for grouped expenses: when a new expense merges into an existing open report, its preview stays mid‑list and we scroll‑to‑index + highlight it instead of jumping to the bottom:
This is exactly why the bug is specific to "a paid expense in chat":
Previous expense still open → the new expense merges into the existing report, so the preview that arrives is the already‑loaded mid‑list preview. index > 0, scrollToIndex(index) works, and the merged expense is shown. No bug.
Previous expense paid (settled) → canAddOrDeleteTransactions returns false for a REIMBURSED report, so shouldCreateNewMoneyRequestReport is true and a brand‑new report + brand‑new preview is created at the live tail (TrackExpense.ts#L1102-L1113, settled check at ReportUtils.ts#L2752-L2770). That preview is then sent to the handler (TrackExpense.ts#L1912-L1916).
Because the user scrolled up, the newest window isn't loaded, so this new preview is not in sortedVisibleReportActions → index === -1. The blanket actionName !== REPORT_PREVIEW exclusion suppresses the live‑tail jump, and index === -1 is not > 0, so the code falls into scrollToBottom() — which only scrolls to the bottom of the stale, loaded window, never reaching the actual new expense at the live tail.
What changes do you think we should make in order to solve the problem?
Only keep a REPORT_PREVIEW out of the live‑tail jump when it is the auto‑merge case (an existing preview already loaded at index > 0). A brand‑new preview that isn't in the loaded window must take the normal live‑tail jump. We hoist the existing findIndex above the guard so it drives both decisions:
- const shouldJumpToLiveTail =- !isOffline && action?.actionName !== CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW && (hasNewerActions || !!linkedReportActionID || unreadMarkerReportActionID);+ const index = sortedVisibleReportActions.findIndex((item) => item.reportActionID === action?.reportActionID);+ // Keep only an auto-merged preview (already loaded at index > 0) out of the live-tail jump so it can be+ // scrolled-to + highlighted below. A brand-new preview (e.g. a new report created because the previous+ // expense is settled) is not in the loaded window while scrolled up, so it must jump to the live tail.+ const isAutoMergedReportPreview = action?.actionName === CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW && index > 0;+ const shouldJumpToLiveTail =+ !isOffline && !isAutoMergedReportPreview && (hasNewerActions || !!linkedReportActionID || unreadMarkerReportActionID);
Then remove the now‑duplicate const index = sortedVisibleReportActions.findIndex(...) on line 110 and let the lower REPORT_PREVIEW branch reuse the hoisted index. No other lines change.
Paid case (new preview, scrolled up): index === -1 → isAutoMergedReportPreview === false → shouldJumpToLiveTail becomes true → openReport loads the newest window and scrolls to the live tail. ✅
Auto‑merge case (existing preview, index > 0): unchanged → scrollToIndex(index) + highlight. ✅
Brand‑new preview when already at the tail (index === 0, hasNewerActions === false): unchanged → falls through to scrollToBottom(). ✅
Files:src/pages/inbox/report/useReportActionsNewActionLiveTail.ts only. Not touched: IOU/data layer (the optimistic data is already correct — only the scroll heuristic is wrong). Platforms: fix is in shared code; verified for iOS App per the report.
What alternative solutions did you explore? (Optional)
Drop the REPORT_PREVIEW exclusion entirely in shouldJumpToLiveTail — rejected: it would break the intended auto‑merge scroll‑to‑index + highlight for expenses merged into an existing open report (the preview would jump to the bottom instead of highlighting in place).
In the else branch, call the live‑tail jump when index === -1 instead of scrollToBottom() — rejected: it duplicates the jump logic in a second place and reorders the highlight/setActionIdToHighlight flow; gating shouldJumpToLiveTail keeps a single jump path.
Force openReport on every expense creation — rejected: unnecessary network round‑trip when the new preview is already loaded at the tail (the common, not‑scrolled‑up case).
⚠️@yusufdeveloper2903 Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
⚠️@JoesyP Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
Activity
applause-bot commentedon May 28, 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/28c96de6598653c3be7d5f2cdfd47790f28ea5f36d165e25430e8e9dc3881133
melvin-bot commentedon May 28, 2026
Triggered auto assignment to @madmax330 (
DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.melvin-bot commentedon May 28, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon May 28, 2026
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
MelvinBot commentedon May 28, 2026
Proposal
What is the root cause of that problem?
When a user creates a new expense in a chat that already contains a paid/settled expense, the code takes a different path than when the existing expense is still active.
With a paid expense,
shouldCreateNewMoneyRequestReportreturnstruebecausecanAddOrDeleteTransactionsreturnsfalsefor settled reports. This causes a newREPORT_PREVIEWaction to be inserted into the chat (a brand-new item at index 0 of the inverted list).Without a paid expense, the existing
REPORT_PREVIEWis updated in-place — no new list item is inserted.The scroll-to-bottom mechanism in
scrollToBottomForCurrentUserActionhandles these two cases differently:findIndexfinds the existing action at its measured position →scrollToIndex(index)scrolls to a known, already-laid-out position. ✅elsebranch callingscrollToBottom()→scrollToIndex({index: 0}). ❌The problem is that when the user has scrolled to the top of the chat (past 250px),
shouldMaintainVisibleContentPositionbecomestrue, which enablesmaintainVisibleContentPositionon the FlashList. With MVCP enabled and the newREPORT_PREVIEWitem just inserted at the head of the inverted list,scrollToIndex({index: 0, animated: false})on iOS doesn't reliably reach the newly inserted item because the item hasn't been laid out yet and MVCP is actively adjusting content offset to keep the currently visible content stable.Additionally,
REPORT_PREVIEWactions are explicitly excluded from theshouldJumpToLiveTailmechanism (which would otherwise reload the newest page viaopenReportand reliably scroll to bottom). The backup scroll viauseScrollToEndOnNewMessageReceivedalso doesn't fire because the user's scroll offset exceedsAUTOSCROLL_TO_TOP_THRESHOLD.What changes do you think we should make in order to solve the problem?
In
scrollToBottomForCurrentUserAction, stop unconditionally excludingREPORT_PREVIEWactions from theshouldJumpToLiveTailpath. When the user has scrolled away from the bottom (hasNewerActionsis true or the scroll offset exceeds the threshold), a newREPORT_PREVIEWshould be allowed to use the live-tail jump mechanism (openReport→ scroll to bottom → prune) the same way other action types do. This ensures the newest page is properly loaded and the scroll reliably reaches the new item.Specifically, change the
shouldJumpToLiveTailcondition to only bypassREPORT_PREVIEWwhen the user is already near the bottom (i.e., the action is visible in the current window), not when the user is scrolled far away.What alternative solutions did you explore? (Optional)
Add a
requestAnimationFramedelay beforescrollToBottom()in theREPORT_PREVIEWhandler to let the newly inserted item's layout settle before scrolling. This would be simpler but fragile — it's a timing hack that may not work on all devices.Temporarily disable
maintainVisibleContentPositionbefore scrolling and re-enable it after. This addresses the MVCP interference directly but is complex to implement cleanly and could cause visual jumps in other scenarios.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.IuliiaHerets commentedon May 28, 2026
Reproduced on iPhone 12/iOS 26.5/Build 9.3.84-1
92e60810-aa9e-48a5-8c72-ebb473ab887e.mp4
IuliiaHerets commentedon May 28, 2026
Reproducible on iPhone 13/iOS 26.3 v9.3.88-0
ScreenRecording_05-28-2026.17-26-10_1.MP4
10 remaining items
mountiny commentedon May 29, 2026
Apparently this is still repro in production. @huult can you please review the proposals?
huult commentedon May 29, 2026
sure
wildan-m commentedon May 29, 2026
Proposal updated — added compare branch with implementation.
KJ21-ENG commentedon May 29, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
After a user scrolls away from the bottom of a 1:1 chat, submitting a new expense should bring the chat back to the newest expense preview. On iOS this fails when the chat already has a paid expense.
What is the root cause of that problem?
Submitting the expense eventually calls
notifyNewAction(activeReportID, reportPreviewAction, true)fromrequestMoney:App/src/libs/actions/IOU/TrackExpense.ts
Lines 1893 to 1897 in eaaffe3
That drives
scrollToBottomForCurrentUserActionin the report action list. For aREPORT_PREVIEW, the code already delaysscrollToIndex(index)when the preview exists atindex > 0, but it callsscrollToBottom()immediately when the preview is atindex === 0or is not found yet:App/src/pages/inbox/report/useReportActionsNewActionLiveTail.ts
Lines 110 to 119 in eaaffe3
On native,
scrollToBottom()is implemented asscrollToIndex({index: 0})on the inverted list:App/src/hooks/useReportScrollManager/index.native.ts
Lines 24 to 30 in eaaffe3
The paid-expense case is the path that exposes this. A paid IOU report cannot accept the new transaction, so the new expense creates a new money request report and a new parent
REPORT_PREVIEWat the head of the inverted FlashList. At the moment the current-user action event runs, that new row can be in Onyx but not yet measured/laid out by iOS FlashList. The immediatescrollToIndex(0)is therefore issued too early and does not move the user from the older scroll position.The normal existing-preview path avoids this because it uses a delayed
scrollToIndex(index). The fallbacksetIsScrollToBottomEnabled(true)does not reliably cover the missed case because it is consumed in the list containeronLayout, which does not necessarily fire for a newly inserted row:App/src/pages/inbox/report/ReportActionsList.tsx
Lines 848 to 855 in eaaffe3
What changes do you think we should make in order to solve the problem?
In
src/pages/inbox/report/useReportActionsNewActionLiveTail.ts, use the same deferred-scroll strategy for theREPORT_PREVIEWindex <= 0branch that theindex > 0branch already uses.Concretely, extract a small helper in the hook, for example
deferScrollToBottom(), that clears the floating counter and callsreportScrollManager.scrollToBottom()inside the existing short timeout used for preview scrolling. Then:index > 0scrollToIndex(index)behavior for already-mounted preview rows;REPORT_PREVIEWwhenindex <= 0;This keeps the existing live-tail/openReport logic intact and only changes the timing of the scroll command in the path where the target row may not be measured yet.
What alternative solutions did you explore? (Optional)
We could route
REPORT_PREVIEWthrough the live-tailopenReport -> scroll -> prunepath when the user is away from the bottom, but that is heavier than necessary for a local optimistic expense submit.We could also wire this to
onContentSizeChange, but that is broader and would need more guards around pagination and edits. A targeted deferred scroll matches the established pattern already used beside the broken branch.aswin-s commentedon May 29, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
github-actions commentedon May 29, 2026
yusufdeveloper2903 commentedon May 29, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
After submitting an expense in a 1:1 chat, the chat does not scroll down to the newly created expense when an already‑paid expense exists in that chat (the view stays where it was instead of jumping to the live tail).
What is the root cause of that problem?
New‑action scrolling is handled in
scrollToBottomForCurrentUserAction. When the user is scrolled away from the live tail (hasNewerActions === true), the handler normally performs a "live‑tail jump" (openReport→ scroll to bottom → prune) so the user lands on the freshly created action. That jump is intentionally skipped for everyREPORT_PREVIEWaction:App/src/pages/inbox/report/useReportActionsNewActionLiveTail.ts
Lines 95 to 96 in f3b36e6
The exclusion exists to preserve the "auto‑merge" behavior added for grouped expenses: when a new expense merges into an existing open report, its preview stays mid‑list and we scroll‑to‑index + highlight it instead of jumping to the bottom:
App/src/pages/inbox/report/useReportActionsNewActionLiveTail.ts
Lines 110 to 123 in f3b36e6
This is exactly why the bug is specific to "a paid expense in chat":
index > 0,scrollToIndex(index)works, and the merged expense is shown. No bug.canAddOrDeleteTransactionsreturnsfalsefor aREIMBURSEDreport, soshouldCreateNewMoneyRequestReportistrueand a brand‑new report + brand‑new preview is created at the live tail (TrackExpense.ts#L1102-L1113, settled check at ReportUtils.ts#L2752-L2770). That preview is then sent to the handler (TrackExpense.ts#L1912-L1916).Because the user scrolled up, the newest window isn't loaded, so this new preview is not in
sortedVisibleReportActions→index === -1. The blanketactionName !== REPORT_PREVIEWexclusion suppresses the live‑tail jump, andindex === -1is not> 0, so the code falls intoscrollToBottom()— which only scrolls to the bottom of the stale, loaded window, never reaching the actual new expense at the live tail.What changes do you think we should make in order to solve the problem?
Only keep a
REPORT_PREVIEWout of the live‑tail jump when it is the auto‑merge case (an existing preview already loaded atindex > 0). A brand‑new preview that isn't in the loaded window must take the normal live‑tail jump. We hoist the existingfindIndexabove the guard so it drives both decisions:Then remove the now‑duplicate
const index = sortedVisibleReportActions.findIndex(...)on line 110 and let the lowerREPORT_PREVIEWbranch reuse the hoistedindex. No other lines change.index === -1→isAutoMergedReportPreview === false→shouldJumpToLiveTailbecomestrue→openReportloads the newest window and scrolls to the live tail. ✅index > 0): unchanged →scrollToIndex(index)+ highlight. ✅index === 0,hasNewerActions === false): unchanged → falls through toscrollToBottom(). ✅Files:
src/pages/inbox/report/useReportActionsNewActionLiveTail.tsonly. Not touched: IOU/data layer (the optimistic data is already correct — only the scroll heuristic is wrong). Platforms: fix is in shared code; verified for iOS App per the report.What alternative solutions did you explore? (Optional)
REPORT_PREVIEWexclusion entirely inshouldJumpToLiveTail— rejected: it would break the intended auto‑merge scroll‑to‑index + highlight for expenses merged into an existing open report (the preview would jump to the bottom instead of highlighting in place).elsebranch, call the live‑tail jump whenindex === -1instead ofscrollToBottom()— rejected: it duplicates the jump logic in a second place and reorders the highlight/setActionIdToHighlightflow; gatingshouldJumpToLiveTailkeeps a single jump path.openReporton every expense creation — rejected: unnecessary network round‑trip when the new preview is already loaded at the tail (the common, not‑scrolled‑up case).github-actions commentedon May 29, 2026
JoesyP commentedon May 31, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
github-actions commentedon May 31, 2026
huult commentedon Jun 1, 2026
ScreenRecording_06-01-2026.09-06-06_1.MP4
Hi contributors, is anyone still able to reproduce this issue?
@IuliiaHerets can you still reproduce this issue?
IuliiaHerets commentedon Jun 1, 2026
@huult Issue is not repro anymore on 9.3.90-1
New.expense.scroll.mp4
huult commentedon Jun 2, 2026
@madmax330 #91919 (comment) As this issue is no longer reproducible, we can close this ticket.