Skip to content

Chat-Nothing happens after tapping "New message" badge after receiving a new message #91901

Closed

Description

@applause-bot

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: 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/13176910/test-cases/41237479
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: iPhone 15 iOS 26.5
App Component: Chat Report View

Action Performed:

Preconditions:
User A is logged in on the main testing device, User B on secondary device.
User A and User B have a chat with 15+ messages.
There is no unread messages in the chat

  1. As User A, open the chat with User B
  2. Scroll to the top of the conversation
  3. As User B, send a new message in the chat
  4. As User A, tap the "New Messages" badge
    Verify the user is scrolled to the bottom of the conversation

Expected Result:

The conversation is scrolled to the new message at the bottom

Actual Result:

Nothing happens after tapping the "New message" badge, the conversation is not scrolled to a new message

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7164550_1779907166451.New_message.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Svetlana Lazutkina
Bug ID: 7164550

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 27, 2026
  2. applause-bot commented on May 27, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/c313d08c037cc3e53e44a37cd2eb3a30c464be059fbe772ab2f9a90657aefd00

  3. melvin-bot commented on May 27, 2026

    @melvin-bot

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

  4. melvin-bot commented on May 27, 2026

    @melvin-bot

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

  5. github-actions commented on May 27, 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.
  6. MelvinBot commented on May 27, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    PR #91296 (merged 2026-05-27) is the regression source. It is the only change between production and staging that touches ReportActionsList.tsx and related rendering files, which aligns with the bug reproducing on staging but not production.

    The PR made two key changes to renderItem in ReportActionsList:

    1. Wrapped each list item in a ReportActionIndexContext.Provider (replacing a bare <> Fragment) — ReportActionsList.tsx:744-774. When a new message arrives at index 0 in the inverted list, every existing item's index shifts by 1, causing every Provider to receive a new value. This changes the component tree structure from what FlashList's recycler expects (Fragment → Provider), which can interfere with FlashList's internal layout tracking on iOS.

    2. Changed the renderItem dependency from report to reportStable — ReportActionsList.tsx:789. reportStable deliberately strips heartbeat fields (lastVisibleActionCreated, lastReadTime, etc.) via getStableReportSelector. This means renderItem no longer recreates when new messages arrive, which may cause FlashList on iOS to not properly update its internal layout state before scrollToIndex({animated: false, index: 0}) is called.

    When the user taps the "New Messages" badge, scrollToBottomAndMarkReportAsRead fires and calls scrollToIndex({index: 0}), but on iOS the inverted FlashList silently fails to execute the scroll — likely because the recycler's internal model is stale due to the memoization change, or because the Provider-wrapped cell structure disrupts FlashList's scroll-to-index calculation.

    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 #91296. The performance optimization it introduced (preventing re-renders on chat heartbeat fields) is valuable but needs to be reworked to not break FlashList's scrollToIndex on iOS.

    If a revert is not preferred, an alternative targeted fix would be to:

    • Remove the ReportActionIndexContext.Provider wrapping from renderItem and find another way to pass index to the rare consumers that need it (e.g., pass it only when entering edit mode)
    • OR restore report (instead of reportStable) in the renderItem dependency array to ensure FlashList gets a fresh renderItem reference when new messages arrive

    What alternative solutions did you explore? (Optional)

    I verified that no other files in the scroll pipeline changed between production and staging — useReportScrollManager, useScrollToEndOnNewMessageReceived, useReportUnreadMessageScrollTracking, FloatingMessageCounter, InvertedFlashList, and useFlashListScrollKey are all identical across both builds. The only dependency change is FullStory's babel plugin (1.5.2 → 1.6.4), which is unrelated to scroll behavior.

    Investigation details

    Scroll flow when badge is tapped:

    1. FloatingMessageCounter.onClick → scrollToBottomAndMarkReportAsRead (ReportActionsList.tsx:897)
    2. Badge is hidden via setIsFloatingMessageCounterVisible(false) (ReportActionsList.tsx:683)
    3. hasNewestReportAction is checked — in this scenario (15+ messages, no pagination), it should be true (ReportActionsList.tsx:444)
    4. reportScrollManager.scrollToBottom() → flatListRef.current.scrollToIndex({animated: false, index: 0}) (index.native.ts:30)

    The handler code itself hasn't changed — the regression is in how the FlashList processes the scroll command given the new renderItem structure.

    Fields stripped by getStableReportSelector: lastMessageText, lastVisibleActionCreated, lastReadTime, lastReadSequenceNumber, lastMentionedTime, lastVisibleActionLastModified, lastMessageHtml, lastActorAccountID, lastActionType (Report.ts:65-77)

    MVCP context: When scrolled to top, shouldMaintainVisibleContentPosition is true (ReportActionsList.tsx:365), so maintainVisibleContentPosition is enabled. On iOS, this could interact with the stale renderItem to prevent the programmatic scroll from taking effect.


    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.

  7. deetergp commented on May 27, 2026

    @deetergp
    Contributor

    @MelvinBot which PR is likely to have caused this?

  8. MelvinBot commented on May 27, 2026

    @MelvinBot
    Contributor

    #91296 — perf: stabilize ReportActionItem with getStableReportSelector and index context by LukasMod, merged 2026-05-27.

    It is the only PR between production and staging that modifies ReportActionsList.tsx or any scroll-related rendering file. See my detailed analysis above for the specific mechanism.

  9. deetergp commented on May 27, 2026

    @deetergp
    Contributor

    @MelvinBot can you comment on that PR that you think it's the cause of this deploy blocker?

  10. LukasMod commented on May 28, 2026

    @LukasMod
    Contributor

    Looking into this right now

  11. LukasMod commented on May 28, 2026

    @LukasMod
    Contributor

    I created revert PR for #91296 and still cant repro that. I think its something else.

    I did some debugging and there is missing list ref in scroll action. It makes sense its related to #91446 based on PR description

    Edit: I did some additional checks based on main branch commits and couldn't repro on my PR pointed by Melvin #91394 (comment)

  12. IuliiaHerets commented on May 28, 2026

    @IuliiaHerets

    Reproducible on iPhone 13/iOS 26.3 v9.3.88-0

    ScreenRecording_05-28-2026.17-15-03_1.MP4
  13. added and removed
    DeployBlockerCashThis issue or pull request should block deployment
    on May 28, 2026
  14. mountiny commented on May 28, 2026

    @mountiny
    Contributor

    Fixed

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

Metadata

Metadata

Assignees

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringReviewingHas a PR in review

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions