Skip to content

regression: Floating date bubble displaying wrong date#40739

Merged
dionisio-bot[bot] merged 2 commits into
release-8.5.0from
fix/dateBubble
May 29, 2026
Merged

regression: Floating date bubble displaying wrong date#40739
dionisio-bot[bot] merged 2 commits into
release-8.5.0from
fix/dateBubble

Conversation

@gabriellsh
Copy link
Copy Markdown
Member

@gabriellsh gabriellsh commented May 29, 2026

Proposed changes (including videos or screenshots)

This was a tricky one to debug, as there wasn't much context on why it happened. A huge thanks for @cardoso for the work on #38200, it allowed debugging using a real server where the issue was found (open.rocket.chat), and if it weren't for that I don't think I'd have been able to patch this.

The issue is as follows:
The message bubble has 2 possibilities for retrieving the date: It can either find a Date Divider (which self-registers by using DateListProvider, and get the information from it's dataset, or it relies on the topmost visible message if no divider matches the filtering.

The issue started happening because of a fix requested on the original PR, which required that some messages to be kept on the DOM (Virtualizer's keepMounted array prop) in order to avoid files contained inside the message to be downloaded every time it mounted due to scrolling.

The logic on the bubble date gives preference to getting the date from the date dividers, and in doing so relied on the virtualization unmounting the elementing and removing it from the list. Since the date divider is a child of the messages, if the parent message of the divider contained a file, it would never unmount the divider, thus never unregistering from the divider list, and being used as the date source since it would be the "oldest" divider on the list.

In order to fix it we now also check the divider's parent visibility relative to the scroll container. This way any divider that should not be visible will be ignored.

Issue(s)

Root cause: #40105
CORE-2248

Steps to test or reproduce

This one is tricky. We need to insert messages with old dates in order to reproduce.

  • Send ~50 messages with an old date (like 3 days ago)
  • Send a single (or more) file message(s) with a newer date (2 days ago) (This message needs to be exactly the next message after the divider, or else it won't break)
  • Send a bunch more messages in that same date (just to create some padding)
  • Send a bunch of messages (~50 to ensure the older ones are out of the screen) in the current date
  • Refresh the room and scroll back until you load the message with the file
  • Scroll back down

Further comments

Summary by CodeRabbit

  • Bug Fixes
    • Improved date divider visibility and accurate positioning when scrolling through message lists
    • Enhanced scroll offset tracking for more reliable date bubble placement in conversations
    • Refined date divider detection logic to better handle visibility states and filter invisible dividers

Review Change Stack

@gabriellsh gabriellsh added this to the 8.5.0 milestone May 29, 2026
@gabriellsh gabriellsh requested review from a team as code owners May 29, 2026 17:51
@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot Bot commented May 29, 2026

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 29, 2026

⚠️ No Changeset found

Latest commit: 7dfe391

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 29, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 241a9ee3-a4c4-4030-97e3-2e1d8344d9f3

📥 Commits

Reviewing files that changed from the base of the PR and between 995d6ea and 7dfe391.

📒 Files selected for processing (3)
  • apps/meteor/client/views/room/MessageList/MessageList.tsx
  • apps/meteor/client/views/room/contextualBar/Threads/components/ThreadMessageList.tsx
  • apps/meteor/client/views/room/hooks/useDateScroll.ts

Walkthrough

This PR enhances date scroll handling by threading scroll offset information through the callback pipeline and implementing threshold-based divider visibility detection. The callback contract is updated to pass offset alongside topMessage, and the hook implementation applies pixel-based visibility thresholds to filter which date dividers are matched for bubble positioning.

Changes

Date Scroll Offset Threading and Visibility Detection

Layer / File(s) Summary
Props contract and scroll handler updates
apps/meteor/client/views/room/MessageList/MessageList.tsx, apps/meteor/client/views/room/contextualBar/Threads/components/ThreadMessageList.tsx
MessageListProps.handleDateScroll callback type is updated to accept (topMessage, offset) instead of only (topMessage). Both MessageList and ThreadMessageList VList onScroll handlers are updated to pass the current scroll offset when invoking the callback.
useDateScroll hook offset handling and visibility logic
apps/meteor/client/views/room/hooks/useDateScroll.ts
Hook return type signature is updated to match the new handleDateScroll contract. A new DATE_DIVIDER_VISIBILITY_THRESHOLD constant defines pixel-based visibility logic. Divider matching logic computes a safe parent-based offset and filters dividers without data-id or outside the visible offset range.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

type: bug

Suggested reviewers

  • cardoso

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gabriellsh gabriellsh changed the base branch from develop to release-8.5.0 May 29, 2026 17:51
@MartinSchoeler MartinSchoeler removed request for a team May 29, 2026 18:22
MartinSchoeler
MartinSchoeler previously approved these changes May 29, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread apps/meteor/client/views/room/hooks/useDateScroll.ts Outdated
tassoevan
tassoevan previously approved these changes May 29, 2026
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
@tassoevan tassoevan dismissed stale reviews from MartinSchoeler and themself via 7dfe391 May 29, 2026 20:03
@tassoevan tassoevan added the stat: QA assured Means it has been tested and approved by a company insider label May 29, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label May 29, 2026
@dionisio-bot dionisio-bot Bot merged commit ed9e2c0 into release-8.5.0 May 29, 2026
10 of 12 checks passed
@dionisio-bot dionisio-bot Bot deleted the fix/dateBubble branch May 29, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge type: bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants