Skip to content

[HOLD #92152][$250] No "New messages" pill when returning to a chat with multiple unread messages — only the first unread is shown #93104

Description

@melvin-bot

Problem

When returning to a room or DM that has multiple unread messages, the chat positions you at the "New" unread marker but shows only the first unread message. No ↓ New messages floating pill appears, so there is no indication that more messages exist below the fold. The same issue occurs when multiple messages arrive rapidly while you are already in the chat.

Reproducible consistently in rooms (e.g. #social) and DMs.

Repro steps

Scenario A – returning to a chat after being away

  1. Be active in a room or DM and send or read a message (so you have a "last read" position).
  2. Leave the chat / go offline for a period while other people post multiple messages.
  3. Return to the chat.
  4. Expected: The chat opens at the "New" marker AND a ↓ New messages pill appears indicating more messages exist below.
  5. Actual: The chat opens at the "New" marker showing only the first unread message. No pill appears. All subsequent messages are hidden below the fold with no indication they exist.

Scenario B – multiple messages arrive while you are in the chat

  1. Be in a DM or room with another person.
  2. Have the other person send 5+ messages in quick succession.
  3. Expected: Either auto-scroll to the newest message, OR show the ↓ New messages pill.
  4. Actual: View stays put, only the most recent message (nearest the unread marker) is visible, no pill appears.

Root cause analysis

There are two related mechanisms at play:

1. Auto-scroll intentionally skips the recipient

useReportActionsNewActionLiveTail.ts only auto-scrolls to the bottom for messages sent by the current user (isFromCurrentUser). For incoming messages the recipient is expected to rely on the floating pill — which is where the bug lies.

2. The pill is gated on the unread marker's visibility, not the bottom's

In useReportUnreadMessageScrollTracking.ts, the pill is force-hidden whenever the unread marker row is considered visible:

const unreadActionVisible = isInverted ? unreadActionIndex >= minIndex : unreadActionIndex <= maxIndex;

if (unreadActionVisible && hasUnreadMarkerReportAction) {
    setIsFloatingMessageCounterVisible(false);
}

The implicit assumption is "if you can see the New marker, you can see all the new messages." This only holds when the entire unread block fits in one viewport.

When many messages have accumulated, ReportActionsList.tsx positions the list at the unread marker (via initialScrollKey), which places the marker near the top of the visible area. The marker row is technically visible so the pill is suppressed — but all the newer messages below the marker are off-screen with no way to know they exist.

Suggested fix direction: Gate the pill on whether the newest / bottom action is visible (combined with "has unread"), rather than solely on whether the unread marker is visible. This way, landing at the marker with more messages below the fold will still surface the ↓ New messages pill.

Affected areas

  • src/pages/inbox/report/useReportUnreadMessageScrollTracking.ts
  • src/pages/inbox/report/useReportActionsNewActionLiveTail.ts
  • src/components/ReportActionsList.tsx (initialScrollKey / scroll-on-mount logic)

Platform

All platforms (confirmed on web/desktop NewDot)

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @mkhutornyi

Activity

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringExternalAdded to denote the issue can be worked on by a contributorMonthlyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions