Skip to content

regression: Duplicated date bubble when it's close to divider#40787

Closed
MartinSchoeler wants to merge 1 commit into
release-8.5.0from
regression-date-buble
Closed

regression: Duplicated date bubble when it's close to divider#40787
MartinSchoeler wants to merge 1 commit into
release-8.5.0from
regression-date-buble

Conversation

@MartinSchoeler
Copy link
Copy Markdown
Member

@MartinSchoeler MartinSchoeler commented Jun 3, 2026

Proposed changes (including videos or screenshots)

Issue(s)

CORE-2276

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • Bug Fixes
    • Improved detection of date divider visibility while scrolling through messages.
    • Enhanced visual behavior of date bubbles when positioned between dividers and the top of the viewport.

@MartinSchoeler MartinSchoeler requested a review from a team as a code owner June 3, 2026 19:11
@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot Bot commented Jun 3, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 3, 2026

Review Change Stack

Walkthrough

The PR adjusts the date divider visibility detection and bubble styling in the useDateScroll hook. The visibility threshold for date dividers decreases from 100px to 50px, explicit opacity styling is added for hidden bubble states, and a comment typo is corrected.

Changes

Date Scroll Bubble Refinement

Layer / File(s) Summary
Date divider visibility threshold and bubble opacity styling
apps/meteor/client/views/room/hooks/useDateScroll.ts
DATE_DIVIDER_VISIBILITY_THRESHOLD reduced from 100 to 50 pixels. Bubble styling for the "between divider and top" positioning now includes explicit opacity: 0 in addition to visibility class behavior. TODO comment wording corrected from "sistem" to "system".

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related issues

Possibly related PRs

Suggested labels

type: bug

Suggested reviewers

  • gabriellsh
  • tassoevan
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately describes the main change: fixing a regression where date bubbles appear duplicated when positioned close to a divider, which aligns with the visibility threshold reduction and opacity styling changes in the code.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • CORE-2276: Request failed with status code 401

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
apps/meteor/client/views/room/hooks/useDateScroll.ts (1)

159-159: ⚡ Quick win

Remove implementation TODO comment from hook code.

Please move this TODO to an issue/PR note (or replace with self-explanatory code) to keep implementation comment-free per project rule.

As per coding guidelines: "**/*.{ts,tsx,js} ... Avoid code comments in the implementation".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/meteor/client/views/room/hooks/useDateScroll.ts` at line 159, Remove the
inline TODO comment in the useDateScroll hook (the line containing "// TODO:
Make the chip \"gliding\" work with the new system."). Either move that task
into your issue tracker or add a self-explanatory code comment as a commit/PR
note, then delete the implementation TODO from the hook implementation (look for
the useDateScroll function export) so the source code remains comment-free per
project guidelines.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@apps/meteor/client/views/room/hooks/useDateScroll.ts`:
- Line 159: Remove the inline TODO comment in the useDateScroll hook (the line
containing "// TODO: Make the chip \"gliding\" work with the new system.").
Either move that task into your issue tracker or add a self-explanatory code
comment as a commit/PR note, then delete the implementation TODO from the hook
implementation (look for the useDateScroll function export) so the source code
remains comment-free per project guidelines.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bf8fc0a7-ca13-4cbb-ac2f-a7bbd18fcd19

📥 Commits

Reviewing files that changed from the base of the PR and between 58984f3 and 3fbe20e.

📒 Files selected for processing (1)
  • apps/meteor/client/views/room/hooks/useDateScroll.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
  • GitHub Check: Hacktron Security Check
  • GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/client/views/room/hooks/useDateScroll.ts
🧠 Learnings (11)
📚 Learning: 2026-06-02T13:27:22.143Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 40755
File: apps/meteor/client/views/room/MessageList/MessageList.tsx:84-94
Timestamp: 2026-06-02T13:27:22.143Z
Learning: In `apps/meteor/client/views/room/MessageList/MessageList.tsx`, the keep-at-bottom `useEffect` intentionally calls `virtualizerRef.current.scrollToIndex(messagesLength, { align: 'end' })` where `messagesLength` is one past the last rendered item index. Using `messagesLength - 1` was tested and caused incorrect scroll positioning. The out-of-bounds index is clamped by Virtua to `itemCount - 1` (last item) — this is intentional and relies on documented stable behavior of the Virtua library. Do not flag this as a bug.

Applied to files:

  • apps/meteor/client/views/room/hooks/useDateScroll.ts
📚 Learning: 2026-04-28T14:08:46.920Z
Learnt from: MartinSchoeler
Repo: RocketChat/Rocket.Chat PR: 40105
File: apps/meteor/client/views/room/MessageList/hooks/useTryToJumpToMessage.ts:54-67
Timestamp: 2026-04-28T14:08:46.920Z
Learning: In `apps/meteor/client/views/room/MessageList/hooks/useTryToJumpToMessage.ts`, setting `isJumpingToMessage.current = true` before the guard clauses (RoomHistoryManager.isLoading check, message not found check) is intentional. The flag means "a jump is pending/in progress" and must stay `true` through all intermediate early-return paths (loading, unresolved message, etc.) so that downstream scroll and load behavior is suppressed while waiting for the jump conditions to be satisfied. Do not flag this as a "flag stuck true" bug.

Applied to files:

  • apps/meteor/client/views/room/hooks/useDateScroll.ts
📚 Learning: 2026-03-11T22:04:20.529Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 39545
File: apps/meteor/client/views/room/body/hooks/useHasNewMessages.ts:59-61
Timestamp: 2026-03-11T22:04:20.529Z
Learning: In `apps/meteor/client/views/room/body/hooks/useHasNewMessages.ts`, the `msg.u._id === uid` early-return in the `streamNewMessage` handler is intentional: the "New messages" indicator is designed to notify about messages from other users only. Self-sent messages — including those sent from a different session/device — are always skipped, by design. Do not flag this as a multi-session regression.

Applied to files:

  • apps/meteor/client/views/room/hooks/useDateScroll.ts
📚 Learning: 2026-01-17T01:51:47.764Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38219
File: packages/core-typings/src/cloud/Announcement.ts:5-6
Timestamp: 2026-01-17T01:51:47.764Z
Learning: In packages/core-typings/src/cloud/Announcement.ts, the AnnouncementSchema.createdBy field intentionally overrides IBannerSchema.createdBy (object with _id and optional username) with a string enum ['cloud', 'system'] to match existing runtime behavior. This is documented as technical debt with a FIXME comment at apps/meteor/app/cloud/server/functions/syncWorkspace/handleCommsSync.ts:53 and should not be flagged as an error until the runtime behavior is corrected.

Applied to files:

  • apps/meteor/client/views/room/hooks/useDateScroll.ts
📚 Learning: 2026-04-10T22:42:05.539Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 40075
File: apps/meteor/client/views/room/modals/FileUploadModal/FileUploadModal.tsx:69-71
Timestamp: 2026-04-10T22:42:05.539Z
Learning: In `apps/meteor/client/views/room/modals/FileUploadModal/FileUploadModal.tsx`, the submit handler converts an empty/whitespace-only description to `undefined` (`description?.trim() || undefined`) intentionally. All downstream image-rendering components (`AttachmentImage`, `ImagePreview`, `ImageItem`, `ImageGallery`) default `undefined` alt to `''`, so the `<img alt="">` attribute is always present. Do not flag this `undefined` conversion as a bug preventing alt text from being cleared.

Applied to files:

  • apps/meteor/client/views/room/hooks/useDateScroll.ts
📚 Learning: 2026-02-24T19:36:55.089Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/page-objects/fragments/home-content.ts:60-82
Timestamp: 2026-02-24T19:36:55.089Z
Learning: In RocketChat/Rocket.Chat e2e tests (apps/meteor/tests/e2e/page-objects/fragments/home-content.ts), thread message preview listitems do not have aria-roledescription="message", so lastThreadMessagePreview locator cannot be scoped to messageListItems (which filters for aria-roledescription="message"). It should remain scoped to page.getByRole('listitem') or mainMessageList.getByRole('listitem').

Applied to files:

  • apps/meteor/client/views/room/hooks/useDateScroll.ts
📚 Learning: 2026-02-10T16:32:42.586Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38528
File: apps/meteor/client/startup/roles.ts:14-14
Timestamp: 2026-02-10T16:32:42.586Z
Learning: In Rocket.Chat's Meteor client code, DDP streams use EJSON and Date fields arrive as Date objects; do not manually construct new Date() in stream handlers (for example, in sdk.stream()). Only REST API responses return plain JSON where dates are strings, so implement explicit conversion there if needed. Apply this guidance to all TypeScript files under apps/meteor/client to ensure consistent date handling in DDP streams and REST responses.

Applied to files:

  • apps/meteor/client/views/room/hooks/useDateScroll.ts
📚 Learning: 2026-05-11T20:30:35.265Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 40480
File: apps/meteor/client/meteor/startup/accounts.ts:59-61
Timestamp: 2026-05-11T20:30:35.265Z
Learning: In Rocket.Chat’s Meteor client code, when calling `dispatchToastMessage` with `{ type: 'error' }`, pass the raw caught error object as `message` without manual normalization. `dispatchToastMessage` is designed to accept `message: unknown` for error toasts, so avoid converting errors to strings (e.g., `String(error)`) or extracting `error.message` before passing them.

Applied to files:

  • apps/meteor/client/views/room/hooks/useDateScroll.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/client/views/room/hooks/useDateScroll.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/client/views/room/hooks/useDateScroll.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • apps/meteor/client/views/room/hooks/useDateScroll.ts
🔇 Additional comments (1)
apps/meteor/client/views/room/hooks/useDateScroll.ts (1)

24-24: LGTM!

Also applies to: 86-86

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 1 file

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/meteor/client/views/room/hooks/useDateScroll.ts">

<violation number="1" location="apps/meteor/client/views/room/hooks/useDateScroll.ts:86">
P1: `opacity: 0` is applied inline here, so the bubble-visible class cannot override it and the date bubble stays hidden in this branch.</violation>
</file>

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

Re-trigger cubic

left: ' 50%',
translate: '-50%',
zIndex: 11,
opacity: 0,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1: opacity: 0 is applied inline here, so the bubble-visible class cannot override it and the date bubble stays hidden in this branch.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/meteor/client/views/room/hooks/useDateScroll.ts, line 86:

<comment>`opacity: 0` is applied inline here, so the bubble-visible class cannot override it and the date bubble stays hidden in this branch.</comment>

<file context>
@@ -83,6 +83,7 @@ export const useDateScroll = (margin = 8): useDateScrollReturn => {
 							left: ' 50%',
 							translate: '-50%',
 							zIndex: 11,
+							opacity: 0,
 						},
 					];
</file context>
Suggested change
opacity: 0,
// opacity handled by bubble-visible class

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

In this specific case we want to override the opacity

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Got it — thanks for clarifying.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (release-8.5.0@58984f3). Learn more about missing BASE report.

Additional details and impacted files

Impacted file tree graph

@@               Coverage Diff                @@
##             release-8.5.0   #40787   +/-   ##
================================================
  Coverage                 ?   69.93%           
================================================
  Files                    ?     3327           
  Lines                    ?   126590           
  Branches                 ?    22002           
================================================
  Hits                     ?    88531           
  Misses                   ?    34769           
  Partials                 ?     3290           
Flag Coverage Δ
unit 70.04% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dougfabris dougfabris added this to the 8.5.0 milestone Jun 3, 2026
@alfredodelfabro alfredodelfabro changed the title regression: Duplicated date bubble when it's close todivider regression: Duplicated date bubble when it's close to divider Jun 3, 2026
@MartinSchoeler
Copy link
Copy Markdown
Member Author

We will continue with #40790

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants