Skip to content

chore: fix jump to thread message e2e test#40690

Merged
MartinSchoeler merged 6 commits into
reg-unreadfrom
chore/fix-jump-to-msg-test
May 26, 2026
Merged

chore: fix jump to thread message e2e test#40690
MartinSchoeler merged 6 commits into
reg-unreadfrom
chore/fix-jump-to-msg-test

Conversation

@MartinSchoeler
Copy link
Copy Markdown
Member

@MartinSchoeler MartinSchoeler commented May 26, 2026

Proposed changes (including videos or screenshots)

Issue(s)

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • Bug Fixes
    • Improved thread deep-link behavior: reliable scroll-to-target with immediate highlight that clears after ~2s; delayed removal of URL message parameter (500ms) only when the target message exists and isn't the main message. Tightened scroll-to-bottom detection to avoid false "at bottom" states.

Review Change Stack

@MartinSchoeler MartinSchoeler requested a review from a team as a code owner May 26, 2026 13:46
@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot Bot commented May 26, 2026

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

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 26, 2026

⚠️ No Changeset found

Latest commit: d276ed9

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 26, 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: e5fe4e89-6e2e-436a-b178-d15483cde57c

📥 Commits

Reviewing files that changed from the base of the PR and between 01f14c2 and 2b325f8.

📒 Files selected for processing (1)
  • apps/meteor/client/views/room/contextualBar/Threads/components/ThreadMessageList.tsx

Walkthrough

ThreadMessageList refactors message-jump handling into two timed effects: one scrolls to and highlights the deep-linked message and schedules highlight removal after 2s; a separate effect clears the msg query parameter after 500ms if the message exists and isn't the mainMessage. Scroll-bottom tracking initialization and checks were tightened.

Changes

Thread message jump and query parameter handling

Layer / File(s) Summary
Scroll-to-bottom bookkeeping adjustments
apps/meteor/client/views/room/contextualBar/Threads/components/ThreadMessageList.tsx
isAtBottom ref initialised to null and bottom check now requires isAtBottom.current === true.
Split scroll/highlight effect and query-param clearing
apps/meteor/client/views/room/contextualBar/Threads/components/ThreadMessageList.tsx
The jump effect only scrolls and highlights, scheduling clearHighlightMessage() after 2s. A new useEffect waits 500ms on msgJumpParam and clears the msg router query parameter only if the message exists in messages and isn't the mainMessage; timeouts are cleaned up on rerun/unmount. Also adds import for setMessageJumpQueryStringParameter.

Sequence Diagram(s)

sequenceDiagram
  participant ThreadMessageList
  participant MessagesStore
  participant Router
  ThreadMessageList->>ThreadMessageList: scroll to msgJumpParam and set highlight
  ThreadMessageList->>ThreadMessageList: setTimeout -> clearHighlightMessage() (2s)
  ThreadMessageList->>MessagesStore: check for msg id existence (after 500ms)
  MessagesStore-->>ThreadMessageList: message exists?
  ThreadMessageList->>Router: clear `msg` query param (if exists and not mainMessage)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • RocketChat/Rocket.Chat#40623: Adjusts how the thread msg router query parameter is handled—related changes to clearing/stripping msg.
  • RocketChat/Rocket.Chat#40624: Also modifies when jump-to-bottom is triggered; related to scroll-bottom gating changes.
  • RocketChat/Rocket.Chat#40642: Modifies the same thread "jump to message" behavior in ThreadMessageList.tsx, including timed handling of the msg query parameter and scroll/highlight logic.

Suggested reviewers

  • cardoso
  • tassoevan

Suggested labels

type: chore

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'chore: fix jump to thread message e2e test' describes the intent to fix an e2e test, but the actual code changes implement fixes to the ThreadMessageList component's deep-link handling and scroll behavior, not directly test fixes. Clarify whether this PR is primarily fixing the e2e test or fixing the underlying component behavior that the test validates. Consider whether the title should reflect the actual component changes being made.
✅ Passed checks (4 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.

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


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.

Actionable comments posted: 1

🤖 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.

Inline comments:
In
`@apps/meteor/client/views/room/contextualBar/Threads/components/ThreadMessageList.tsx`:
- Around line 138-149: The effect watching msgJumpParam currently depends on
items (an array recreated each render) which restarts the 500ms timeout
repeatedly; fix by making the effect depend on a stable identity instead of the
ephemeral items array: either memoize a derived stable value (e.g., itemsIds =
useMemo(() => items.map(m => m._id), [items.length, /*other stable keys*/]) and
use itemsIds in the dependency list) or store items in a ref (e.g.,
itemsRef.current = items) and read from itemsRef.current inside the useEffect
while keeping dependencies to [msgJumpParam, mainMessage._id]; update the effect
to check for the id via the stable value/ref and call
setMessageJumpQueryStringParameter(null) when found.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b44aee01-d039-41c4-80c2-41b058bf06ae

📥 Commits

Reviewing files that changed from the base of the PR and between 6fb88e1 and ab7f60d.

📒 Files selected for processing (1)
  • apps/meteor/client/views/room/contextualBar/Threads/components/ThreadMessageList.tsx
📜 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/contextualBar/Threads/components/ThreadMessageList.tsx
🧠 Learnings (2)
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.

Applied to files:

  • apps/meteor/client/views/room/contextualBar/Threads/components/ThreadMessageList.tsx
📚 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/contextualBar/Threads/components/ThreadMessageList.tsx

@codecov
Copy link
Copy Markdown

codecov Bot commented May 26, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.64%. Comparing base (acc4ce6) to head (2b325f8).
⚠️ Report is 4 commits behind head on reg-unread.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff               @@
##           reg-unread   #40690      +/-   ##
==============================================
- Coverage       69.64%   69.64%   -0.01%     
==============================================
  Files            3338     3338              
  Lines          123266   123266              
  Branches        21980    21931      -49     
==============================================
- Hits            85847    85845       -2     
- Misses          34057    34068      +11     
+ Partials         3362     3353       -9     
Flag Coverage Δ
unit 70.45% <50.00%> (+<0.01%) ⬆️

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.

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

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

Re-trigger cubic

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 (changes from recent commits).

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/contextualBar/Threads/components/ThreadMessageList.tsx">

<violation number="1" location="apps/meteor/client/views/room/contextualBar/Threads/components/ThreadMessageList.tsx:143">
P2: `msg` is no longer cleared when it points to the thread main message, which can leave the list stuck in deep-link mode and block normal auto-jump-to-bottom behavior.</violation>
</file>

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

Re-trigger cubic

@MartinSchoeler MartinSchoeler changed the base branch from release-8.5.0 to reg-unread May 26, 2026 17:41
@MartinSchoeler MartinSchoeler merged commit 68815cc into reg-unread May 26, 2026
9 of 11 checks passed
@MartinSchoeler MartinSchoeler deleted the chore/fix-jump-to-msg-test branch May 26, 2026 19:00
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.

1 participant