Skip to content

[Due for payment 2026-04-14] Chat header is not scrolled to the bottom #86787

Closed

Description

@mitarachim

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v9.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-14590/folder/13176686/41236624/1295549336?sort=%2Bidentifier
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: Windows 11/ Chrome
App Component: Chat Report View

Action Performed:

  1. Sign in to staging.new.expensify.com
  2. Create a workspace
  3. Navigate to workspace chat with no conversation

Expected Result:

Chat header and welcome message is scrolled to the bottom

Actual Result:

Chat header and welcome message is not scrolled to the bottom

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7118363_1774987435761.bandicam_2026-03-31_22-56-20-458.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. added
    DeployBlockerCash
    Daily
    Bug
    DeployBlocker
    on Mar 31, 2026
  2. melvin-bot commented on Mar 31, 2026

    @melvin-bot

    Triggered auto assignment to @chuckdries (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  3. melvin-bot commented on Mar 31, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  4. github-actions commented on Mar 31, 2026

    @github-actions
    Contributor

    👋 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:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  5. OSBotify commented on Mar 31, 2026

    @OSBotify
    Contributor

    Investigation Summary

    Classification: Frontend bug
    Causing PR: #83078 - "Fix: Bottom comments briefly visible when switching between chats in Expenses" by @marufsharifi (High confidence)
    Related Issues: This is the same issue that PR #85788 (currently closed/not merged) was attempting to fix

    Recommendation: REVERT

    PR #83078 should be reverted. The PR was intended to fix bottom comments briefly being visible when switching between chats in expense reports, but it introduced a regression where workspace chat welcome messages are not properly scrolled to the bottom on initial load.

    Labels: Removing DeployBlocker (backend label). Keeping DeployBlockerCash since this is a frontend bug that requires an App PR to be reverted.

    Detailed Analysis

    Evidence

    PR #83078 modified ReportActionsList.tsx and introduced a new function getReportActionsListInitialNumToRender that determines how many report actions to initially render based on various conditions including shouldScrollToEndAfterLayout and hasCreatedActionAdded flags.

    The problematic logic is in the new function:

    if (shouldScrollToEndAfterLayout && (!hasCreatedActionAdded || isOffline)) {
        return sortedVisibleReportActionsLength;
    }

    This change affects the initial rendering and scrolling behavior for workspace chats. When navigating to a newly created workspace chat (which has no conversation), the scroll position is not properly set to the bottom, leaving the welcome header and message not scrolled into view.

    Verification

    1. PR Fix: Bottom comments briefly visible when switching between chats in Expenses #83078 was merged on 2026-03-31 at 16:25:54Z
    2. It is included in the current staging deploy (9.3.51-0) - listed as item Add unread message indicator to browser tab #91 in chronological order
    3. The bug is reproducible on staging but NOT on production, confirming it was introduced in this deploy
    4. The issue affects workspace chats specifically, which aligns with the changes made to scroll behavior in ReportActionsList

    Root Cause

    The PR introduced logic to render all visible report actions when shouldScrollToEndAfterLayout is true and either the created action hasnt been added or the app is offline. This prevents the normal scroll-to-bottom mechanism from working correctly for workspace chats with welcome messages, as the initial render count affects how the FlatList positions content.

    Additionally, PR #85788 was created to fix this exact issue (titled "Fix: Welcome header showing after contents in workspace chat") but is currently closed and not merged. The author of that PR identified the problem in the scrollToBottomForCurrentUserAction function where workspace chats dont go through the shouldFocusToTopOnMount scroll path, causing a race condition with the FlatList layout.

  6. removed
    DeployBlocker
    on Mar 31, 2026
  7. MelvinBot commented on Mar 31, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    PR #80122 switched ReportActionsList from using InvertedFlatList to FlatListWithScrollKey (a non-inverted list). This fundamentally changes how short-content chats are displayed:

    • Before (production, InvertedFlatList): The list uses a CSS scaleY(-1) transform. When content (just the welcome message/header) is shorter than the viewport, items naturally appear at the visual bottom because the entire list is flipped vertically. No scrolling is needed.

    • After (staging, FlatListWithScrollKey): The list is non-inverted. The chatContentScrollView style applies flexGrow: 1 + justifyContent: 'flex-start' (src/styles/index.ts), which makes the container fill the viewport but pins content to the top. The mount-time scrollToBottom() call (ReportActionsList.tsx line ~547) invokes scrollToEnd(), but this is a no-op when content height is less than viewport height — there is nothing to scroll to.

    For workspace chats with no conversation, the only content is the CREATED action (welcome message + header), which is shorter than the viewport. With the non-inverted list, this content is stuck at the top with no mechanism to push it to the bottom.

    A secondary contributor is PR #83078, which changed the initialNumToRender calculation to depend on reactive values like sortedVisibleReportActions.length. This can cause FlatList re-renders that race with the mount-time scrollToBottom(), potentially affecting even chats with enough content to scroll.

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

    Since this is a deploy blocker, the safest path is to revert PR #80122. This restores InvertedFlatList which naturally handles short-content chats by rendering content at the visual bottom.

    If a revert is not desired (because PR #80122 fixed keyboard navigation issues), an alternative fix would be to change the contentContainerStyle for the non-inverted list to use justifyContent: 'flex-end' so that short content is pushed to the bottom of the container. This would need to be applied in ReportActionsList.tsx where FlatListWithScrollKey is rendered (around line ~935). The style would need to be conditional — only for non-inverted, non-linked-action views.

    What alternative solutions did you explore? (Optional)

    1. Fix scrollToBottom to handle short content — Not viable. scrollToEnd() on a FlatList physically cannot scroll past the content boundary. The issue is layout, not scrolling.
    2. Add a spacer view above content — Could work by inserting a flex spacer that pushes content down when content is shorter than viewport. More complex and fragile than the justifyContent: 'flex-end' approach.
    3. Revert PR Fix: Bottom comments briefly visible when switching between chats in Expenses #83078 instead — This PR causes a secondary race condition, but reverting it alone would NOT fix the fundamental layout issue from PR Fix: Keyboard Navigation: Paid expense details: The content is focused in a confusing order #80122 where short content cannot appear at the bottom.
    Detailed Investigation

    Evidence Chain

    1. PR Fix: Keyboard Navigation: Paid expense details: The content is focused in a confusing order #80122 (merged 2026-03-30) replaced InvertedFlatList with FlatListWithScrollKey in ReportActionsList.tsx
    2. chatContentScrollView style uses flexGrow: 1 + justifyContent: 'flex-start' — content fills viewport but starts at top
    3. For workspace chats with no conversation, only the CREATED action exists (welcome message) — content is shorter than viewport
    4. Mount-time scrollToBottom() → scrollToEnd() is a no-op when content < viewport height
    5. Result: welcome message stuck at top instead of appearing at bottom

    Relevant Code

    • src/pages/inbox/report/ReportActionsList.tsx:935 — Now uses FlatListWithScrollKey instead of InvertedFlatList
    • src/hooks/useReportScrollManager/index.ts:32 — scrollToEnd() is a no-op when content < viewport
    • src/styles/index.ts:1984 — chatContentScrollView uses justifyContent: 'flex-start'
    • src/pages/inbox/report/ReportActionsList.tsx:536-550 — Mount-time scroll effect that can't fix short content

    Timeline


    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.

  8. 16 remaining items

  9. mallenexpensify commented on Apr 1, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @Krishna2323 due $250 via NewDot

    I think we're good to close

  10. melvin-bot commented on Apr 1, 2026

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

  11. mallenexpensify commented on Apr 2, 2026

    @mallenexpensify
    Contributor

    @Krishna2323 eyes on the deploy blocker comment above plz

  12. Krishna2323 commented on Apr 2, 2026

    @Krishna2323
    Contributor
  13. Krishna2323 commented on Apr 4, 2026

    @Krishna2323
    Contributor

    Requested in ND.

  14. twisterdotcom commented on Apr 5, 2026

    @twisterdotcom
    Contributor

    @Krishna2323 has submitted payment for this report on ND here.

    SO: https://stackoverflowteams.com/c/expensify/questions/7582

    Zapier Logs Run ID: 00040eee-c25c-abc3-84db-61c909fc75d4
  15. added
    Weekly
    and removed
    Daily
    on Apr 7, 2026
  16. changed the title [-]Chat header is not scrolled to the bottom[/-] [+][Due for payment 2026-04-14] Chat header is not scrolled to the bottom[/+] on Apr 7, 2026
  17. melvin-bot commented on Apr 7, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.52-9 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-04-14. 🎊

    For reference, here are some details about the assignees on this issue:

    • @Krishna2323 requires payment through NewDot Manual Requests
  18. melvin-bot commented on Apr 7, 2026

    @melvin-bot

    @Krishna2323 @mallenexpensify The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  19. quinthar commented on Apr 13, 2026

    @quinthar
    Contributor

    Approved $250 to @Krishna2323

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentBugEngineeringWeekly

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions