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
Chat - Chat is scrolling up after editing a message #86813
Version Number: 9.3.51-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/test-runs/TR-14589/folder/13176723/41237031/1295548358 Email or phone of affected tester (no customers): N/A Issue reported by: Applause Internal Team Bug source: Regression TC Execution Device used: Web App Component: Other
Action Performed:
Navigate to ND
Open a chat with some history
Send a message
Right click on the message
Click on "Edit Comment"
Edit the message and press ENTER
Expected Result:
Chat should maintain in the same position after editing a message.
Actual Result:
After editing a message chat is automatically scrolling up.
👋 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.
Classification: Frontend bug Causing PR: #86119 - "decompose ReportScreen 5: self-subscribe List and Composer" by @adhorodyski (Medium confidence) Related Issues: None found
Recommendation: NEEDS INVESTIGATION
The bug describes chat scrolling up after editing a message, which only reproduces on staging (not production). PR #86119 refactored ReportActionsView and ReportActionCompose components, making them self-subscribing and reducing prop drilling. This refactor could have inadvertently affected scroll position maintenance when messages are edited.
Rationale: While PR #86119 is the most likely candidate due to its timing (merged March 30) and scope (refactoring report view components), I cannot definitively confirm it touches message edit scroll behavior without deeper code analysis. The PR mentions it reduced ReportActionsView from 13 props to 2 and ReportActionCompose from 11 props to 1, which could affect how the component re-renders when a message is edited.
Labels: Keep DeployBlockerCash (this is a frontend bug affecting staging)
Detailed Analysis
Evidence
Bug is staging-only, not reproducible in production
Affects Windows Chrome (web platform)
Version: 9.3.51-0
The issue occurs specifically when editing a message and pressing ENTER
Expected: Chat should maintain scroll position
Actual: Chat automatically scrolls up
Candidate PRs Investigated
From the StagingDeployCash checklist for v9.3.51-0, I examined recent PRs that could affect chat/message behavior:
The refactoring in PR #86119 changed how ReportActionsView manages its state and renders. When a message is edited, the component may be re-rendering or re-subscribing in a way that causes the scroll position to reset. The move from prop-based updates to useOnyx subscriptions could be triggering unnecessary list recalculations.
Next Steps
@adhorodyski - PR author should verify if scroll position preservation logic was maintained during the refactor
Check if ReportActionsList scroll position is being preserved when ReportActionsView updates
Verify if the message edit completion triggers a full list re-render instead of a targeted update
PR #80122 migrated the chat list in ReportActionsList.tsx from InvertedFlatList to a non-inverted FlatListWithScrollKey (with manually reversed data). This architectural change broke scroll position maintenance during message editing because:
MVCP (Maintain Visible Content Position) is disabled in normal viewing mode. In useFlatListScrollKey.ts:119-121, maintainVisibleContentPosition returns undefined when there is no initialScrollKey (i.e. not linked to a specific message). This means the MutationObserver in the web FlatList (src/components/FlatList/FlatList/index.tsx:127) early-returns from adjustForMaintainVisibleContentPosition without compensating for content size changes.
In the old inverted list, the scroll anchor was at offset 0 (= bottom/newest messages). When the edit composer was removed and content shrank, the browser naturally kept the visual position stable. In the new non-inverted list, the scroll anchor is at offset 0 (= top/oldest messages). When the edit composer is removed and content height decreases, the scroll position from the top stays fixed while the content shifts upward, causing the visible "scroll up" effect.
Additionally, ReportActionItemMessageEdit.tsx:119 calls useReportScrollManager() with the default isInverted=true, while the list now uses useReportScrollManager(false). This causes deleteDraft's scrollToIndex(0) call (line 296-299) to reference index 0 of the reversed flatListData array (= oldest message) instead of the newest message.
This is the same PR causing related deploy blockers #86787 and #86794.
What changes do you think we should make in order to solve the problem?
Two changes are needed:
Enable MVCP during edit mode: Ensure that maintainVisibleContentPosition in useFlatListScrollKey.ts is active (not undefined) when the edit composer is being shown/removed, so the MutationObserver's adjustForMaintainVisibleContentPosition can compensate for the height change. Alternatively, the adjustForMaintainVisibleContentPosition function in FlatList/index.tsx could be modified to not early-return when mvcpMinIndexForVisible == null if it detects an edit composer change (it already has isEditComposerAdded detection at line 160-175).
Fix the scroll manager mismatch: Update ReportActionItemMessageEdit.tsx:119 to use useReportScrollManager(false) to match the non-inverted list orientation. The scrollToIndex call in deleteDraft also needs to account for the reversed data array (index 0 in the original sorted data = last index in flatListData).
What alternative solutions did you explore? (Optional)
Adding a dedicated scroll position save/restore mechanism around the edit flow (save scroll position before showing editor, restore after hiding) could work but would be more fragile than fixing the MVCP approach.
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.
What it changed: PR #80122 migrated the chat message list in ReportActionsList.tsx from InvertedFlatList to a non-inverted FlatListWithScrollKey with manually reversed data. This architectural change broke the scroll position maintenance that previously worked naturally with the inverted list orientation. See my earlier analysis for full root cause details and recommended fix.
All three deploy blockers (#86787, #86794, #86813) stem from this same PR and would be resolved by either fixing the MVCP behavior in the non-inverted list or reverting PR #80122.
Activity
melvin-bot commentedon Mar 31, 2026
Triggered auto assignment to @Julesssss (
DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.melvin-bot commentedon Mar 31, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon Mar 31, 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:
OSBotify commentedon Mar 31, 2026
Investigation Summary
Classification: Frontend bug
Causing PR: #86119 - "decompose ReportScreen 5: self-subscribe List and Composer" by @adhorodyski (Medium confidence)
Related Issues: None found
Recommendation: NEEDS INVESTIGATION
The bug describes chat scrolling up after editing a message, which only reproduces on staging (not production). PR #86119 refactored
ReportActionsViewandReportActionComposecomponents, making them self-subscribing and reducing prop drilling. This refactor could have inadvertently affected scroll position maintenance when messages are edited.Rationale: While PR #86119 is the most likely candidate due to its timing (merged March 30) and scope (refactoring report view components), I cannot definitively confirm it touches message edit scroll behavior without deeper code analysis. The PR mentions it reduced
ReportActionsViewfrom 13 props to 2 andReportActionComposefrom 11 props to 1, which could affect how the component re-renders when a message is edited.Labels: Keep
DeployBlockerCash(this is a frontend bug affecting staging)Detailed Analysis
Evidence
Candidate PRs Investigated
From the StagingDeployCash checklist for v9.3.51-0, I examined recent PRs that could affect chat/message behavior:
PR decompose ReportScreen 5: self-subscribe List and Composer #86119 (MOST LIKELY) - "decompose ReportScreen 5: self-subscribe List and Composer"
ReportActionsViewandReportActionComposePR [No QA] perf: remove redundant reportNameValuePairs collection subscription from LHN #86644 - LHN performance optimization (removed redundant NVP subscription)
PR [NoQA] Removed unused files (batch 1) #86450, [No QA] fix: move
AppStartTimerecording fromMainApplicationtoMainActivity#86468, [No QA] Add node_modules to module names #86515 - Various No QA changesRoot Cause Hypothesis
The refactoring in PR #86119 changed how
ReportActionsViewmanages its state and renders. When a message is edited, the component may be re-rendering or re-subscribing in a way that causes the scroll position to reset. The move from prop-based updates touseOnyxsubscriptions could be triggering unnecessary list recalculations.Next Steps
ReportActionsListscroll position is being preserved whenReportActionsViewupdatesJulesssss commentedon Mar 31, 2026
@MelvinBot investigate this, try and locate the PR that caused this
vincdargento commentedon Mar 31, 2026
Culprit PR was not identified, the issue is reproducible in every snapshot build of the checklist
MelvinBot commentedon Mar 31, 2026
Proposal
What is the root cause of that problem?
PR #80122 migrated the chat list in
ReportActionsList.tsxfromInvertedFlatListto a non-invertedFlatListWithScrollKey(with manually reversed data). This architectural change broke scroll position maintenance during message editing because:MVCP (Maintain Visible Content Position) is disabled in normal viewing mode. In
useFlatListScrollKey.ts:119-121,maintainVisibleContentPositionreturnsundefinedwhen there is noinitialScrollKey(i.e. not linked to a specific message). This means theMutationObserverin the webFlatList(src/components/FlatList/FlatList/index.tsx:127) early-returns fromadjustForMaintainVisibleContentPositionwithout compensating for content size changes.In the old inverted list, the scroll anchor was at offset 0 (= bottom/newest messages). When the edit composer was removed and content shrank, the browser naturally kept the visual position stable. In the new non-inverted list, the scroll anchor is at offset 0 (= top/oldest messages). When the edit composer is removed and content height decreases, the scroll position from the top stays fixed while the content shifts upward, causing the visible "scroll up" effect.
Additionally,
ReportActionItemMessageEdit.tsx:119callsuseReportScrollManager()with the defaultisInverted=true, while the list now usesuseReportScrollManager(false). This causesdeleteDraft'sscrollToIndex(0)call (line 296-299) to reference index 0 of the reversedflatListDataarray (= oldest message) instead of the newest message.This is the same PR causing related deploy blockers #86787 and #86794.
What changes do you think we should make in order to solve the problem?
Two changes are needed:
Enable MVCP during edit mode: Ensure that
maintainVisibleContentPositioninuseFlatListScrollKey.tsis active (notundefined) when the edit composer is being shown/removed, so theMutationObserver'sadjustForMaintainVisibleContentPositioncan compensate for the height change. Alternatively, theadjustForMaintainVisibleContentPositionfunction inFlatList/index.tsxcould be modified to not early-return whenmvcpMinIndexForVisible == nullif it detects an edit composer change (it already hasisEditComposerAddeddetection at line 160-175).Fix the scroll manager mismatch: Update
ReportActionItemMessageEdit.tsx:119to useuseReportScrollManager(false)to match the non-inverted list orientation. ThescrollToIndexcall indeleteDraftalso needs to account for the reversed data array (index 0 in the original sorted data = last index inflatListData).What alternative solutions did you explore? (Optional)
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.MelvinBot commentedon Mar 31, 2026
The culprit PR is #80122 ("Fix: Keyboard Navigation: Paid expense details").
Evidence:
What it changed: PR #80122 migrated the chat message list in
ReportActionsList.tsxfromInvertedFlatListto a non-invertedFlatListWithScrollKeywith manually reversed data. This architectural change broke the scroll position maintenance that previously worked naturally with the inverted list orientation. See my earlier analysis for full root cause details and recommended fix.All three deploy blockers (#86787, #86794, #86813) stem from this same PR and would be resolved by either fixing the MVCP behavior in the non-inverted list or reverting PR #80122.
Julesssss commentedon Apr 1, 2026
This should have been resolved with this revert CP: #86802
I requested QA testing for verification.
Julesssss commentedon Apr 1, 2026
Requested QA testing again
m-natarajan commentedon Apr 1, 2026
Not repro on Mac 15.4.1 Safari, v9.3.51-7
Recording.1923.mp4