regression: unfollowed thread message marked as unread#40644
Conversation
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughFirst-unread selection excludes thread-only messages unless tshow === true. Navigation now sets an optional jumpContext ( ChangesUnread message filtering by thread visibility
Sequence Diagram(s)sequenceDiagram
participant UnreadHook
participant RouterUtil as setMessageJumpQueryStringParameter
participant URLSearchParams
participant ThreadJumpHook as useTryToJumpToThreadMessage
UnreadHook->>RouterUtil: setMessageJumpQueryStringParameter(msgId, 'jumpToUnread')
RouterUtil->>URLSearchParams: read current search, include jumpContext when provided
ThreadJumpHook->>URLSearchParams: read jumpContext param
ThreadJumpHook-->>ThreadJumpHook: exit early if jumpContext == jumpToUnread
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (2)
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. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/meteor/client/views/room/body/hooks/useUnreadMessages.ts (1)
93-99:⚠️ Potential issue | 🟠 Major | ⚡ Quick winUnread count predicate is inconsistent with the new thread filter.
updateFirstUnreadRecordId()andhandleUnreadBarJumpToButtonClick()now exclude thread-only messages via(!record.tmid || record.tshow === true), but thisfilterMessagescall still counts them. This can produce a non-zero unread badge with no corresponding unread mark or jump target (the regression this PR addresses can still surface here when only threaded replies are loaded for the room), keeping the bar visible until a manual mark-as-read.🔧 Suggested fix
const count = filterMessages( (record) => record.rid === room._id && !!lastMessageDate && record.ts.getTime() <= lastMessageDate?.getTime() && - record.ts.getTime() > (subscription?.ls?.getTime() ?? -Infinity), + record.ts.getTime() > (subscription?.ls?.getTime() ?? -Infinity) && + (!record.tmid || record.tshow === true), ).length;🤖 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/body/hooks/useUnreadMessages.ts` around lines 93 - 99, The unread count predicate used in filterMessages in useUnreadMessages.ts is still including thread-only messages, causing a mismatch with updateFirstUnreadRecordId and handleUnreadBarJumpToButtonClick; modify the predicate used to compute count so it mirrors the other functions by excluding thread-only messages (add the same condition: (!record.tmid || record.tshow === true)) alongside the existing checks for record.rid, lastMessageDate, and subscription.ls to ensure the badge and jump target stay in sync.
🧹 Nitpick comments (1)
apps/meteor/client/views/room/body/hooks/useUnreadMessages.ts (1)
67-72: 💤 Low valueNit: comparator indentation is misaligned.
Line 71’s comparator argument is indented one extra level beyond the predicate argument on line 67, making it visually appear nested inside the predicate. Aligning both arguments at the same indent improves readability.
🎨 Suggested formatting
message = findFirstMessage( (record) => record.rid === rid && record.ts.getTime() > (unread?.since.getTime() ?? -Infinity) && - (!record.tmid || record.tshow === true), - (a, b) => a.ts.getTime() - b.ts.getTime(), + (!record.tmid || record.tshow === true), + (a, b) => a.ts.getTime() - b.ts.getTime(), );🤖 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/body/hooks/useUnreadMessages.ts` around lines 67 - 72, In useUnreadMessages.ts the second argument comparator "(a, b) => a.ts.getTime() - b.ts.getTime()" is indented one level deeper than the predicate "(record) => ..." making it look nested; align the comparator's indentation so both arguments to the call start at the same column as the predicate to improve readability (adjust the line containing the "(a, b) => ..." arrow function to match the predicate's indentation).
🤖 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.
Outside diff comments:
In `@apps/meteor/client/views/room/body/hooks/useUnreadMessages.ts`:
- Around line 93-99: The unread count predicate used in filterMessages in
useUnreadMessages.ts is still including thread-only messages, causing a mismatch
with updateFirstUnreadRecordId and handleUnreadBarJumpToButtonClick; modify the
predicate used to compute count so it mirrors the other functions by excluding
thread-only messages (add the same condition: (!record.tmid || record.tshow ===
true)) alongside the existing checks for record.rid, lastMessageDate, and
subscription.ls to ensure the badge and jump target stay in sync.
---
Nitpick comments:
In `@apps/meteor/client/views/room/body/hooks/useUnreadMessages.ts`:
- Around line 67-72: In useUnreadMessages.ts the second argument comparator "(a,
b) => a.ts.getTime() - b.ts.getTime()" is indented one level deeper than the
predicate "(record) => ..." making it look nested; align the comparator's
indentation so both arguments to the call start at the same column as the
predicate to improve readability (adjust the line containing the "(a, b) => ..."
arrow function to match the predicate's indentation).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: def17188-f4c2-4529-8fce-cad4756fca6e
📒 Files selected for processing (2)
apps/meteor/client/lib/chats/readStateManager.tsapps/meteor/client/views/room/body/hooks/useUnreadMessages.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/body/hooks/useUnreadMessages.tsapps/meteor/client/lib/chats/readStateManager.ts
🧠 Learnings (5)
📚 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/body/hooks/useUnreadMessages.tsapps/meteor/client/lib/chats/readStateManager.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/body/hooks/useUnreadMessages.tsapps/meteor/client/lib/chats/readStateManager.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/body/hooks/useUnreadMessages.tsapps/meteor/client/lib/chats/readStateManager.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/body/hooks/useUnreadMessages.tsapps/meteor/client/lib/chats/readStateManager.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/body/hooks/useUnreadMessages.tsapps/meteor/client/lib/chats/readStateManager.ts
🔇 Additional comments (1)
apps/meteor/client/lib/chats/readStateManager.ts (1)
75-76: LGTM!
|
Regarding CORE-2221, while testing, found a case this PR doesn't cover: if the oldest unread message is a thread parent (not a reply), clicking the bubble still opens the thread panel. Tracing it down, this is a side-effect of #40105. The old One option is to make the URL source-aware: have the bubble add an extra parameter alongside msg (e.g. Screen.Recording.2026-05-21.at.15.24.15.mov |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## release-8.5.0 #40644 +/- ##
================================================
Coverage ? 69.63%
================================================
Files ? 3338
Lines ? 123300
Branches ? 22000
================================================
Hits ? 85861
Misses ? 34071
Partials ? 3368
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🧹 Nitpick comments (2)
apps/meteor/client/views/room/MessageList/hooks/useTryToJumpToThreadMessage.spec.ts (2)
62-88: ⚡ Quick winConsider mocking and verifying
goToRoom()behavior.The test asserts that
RoomHistoryManagermethods are not called whenjumpContext === 'jumpToUnread', which correctly verifies the early return. However, the implementation also callsgoToRoom()to navigate to the thread panel in the non-early-return path. While the early return prevents this call, explicitly mockinguseGoToRoom()and asserting that the returned function was not called would make the test's "should not navigate" claim more robust and self-documenting.Example: Mock and verify goToRoom
Add a mock for the hook:
const mockGoToRoom = jest.fn(); jest.mock('../../../../hooks/useGoToRoom', () => ({ useGoToRoom: () => mockGoToRoom, }));Then assert in the test:
expect(mockGoToRoom).not.toHaveBeenCalled();🤖 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/MessageList/hooks/useTryToJumpToThreadMessage.spec.ts` around lines 62 - 88, The test for useTryToJumpToThreadMessage should also mock and verify the navigation function to prove "should not navigate": add a jest mock for the useGoToRoom hook (returning a jest.fn() like mockGoToRoom) so the hook used by useTryToJumpToThreadMessage is replaced, then in this test assert mockGoToRoom was not called; keep the existing assertions that mockedRoomHistoryManager.getSurroundingMessages and .getMore were not called and ensure the endpointSpy expectation remains.
48-90: ⚡ Quick winConsider adding positive-path test coverage.
The current tests verify that the hook correctly skips thread navigation when
msgis absent orjumpContext === 'jumpToUnread'. To ensure the fix doesn't regress intended behavior, consider adding a test case wheremsgis present andjumpContextis undefined or a different value, verifying thatgoToRoom()is called and messages are loaded as expected.Example test case
it('should navigate and load messages when jumpContext is not jumpToUnread', async () => { const threadMessage = { _id: 'msg-1', rid: 'room-1', tmid: 'parent-msg-1', ts: new Date('2024-01-01T00:00:00Z').toISOString(), u: { _id: 'user-1', username: 'john' }, msg: 'Thread reply', _updatedAt: new Date('2024-01-01T00:00:00Z').toISOString(), }; const endpointSpy = jest.fn().mockResolvedValue({ message: threadMessage }); const mockGoToRoom = jest.fn(); renderHook(() => useTryToJumpToThreadMessage(), { wrapper: mockAppRoot() .withRouter({ getSearchParameters: () => ({ msg: 'msg-1' }) }) .withEndpoint('GET', '/v1/chat.getMessage', endpointSpy) .build(), }); await waitFor(() => { expect(mockGoToRoom).toHaveBeenCalledWith('room-1', expect.objectContaining({ routeParamsOverrides: { tab: 'thread', context: 'parent-msg-1' }, })); }); });🤖 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/MessageList/hooks/useTryToJumpToThreadMessage.spec.ts` around lines 48 - 90, Add a positive-path test for useTryToJumpToThreadMessage: when the router search parameter includes msg (e.g., { msg: 'msg-1' }) and jumpContext is absent or not 'jumpToUnread', mock the GET /v1/chat.getMessage endpoint to return a thread message and stub goToRoom, then assert the endpoint was called with { msgId: 'msg-1' }, that goToRoom was invoked with the message.rid and routeParamsOverrides including tab: 'thread' and context equal to the message.tmid (use the goToRoom spy), and that mockedRoomHistoryManager.getSurroundingMessages or getMore were called to load the messages; use the existing renderHook + mockAppRoot setup and waitFor to await async behavior.
🤖 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/MessageList/hooks/useTryToJumpToThreadMessage.spec.ts`:
- Around line 62-88: The test for useTryToJumpToThreadMessage should also mock
and verify the navigation function to prove "should not navigate": add a jest
mock for the useGoToRoom hook (returning a jest.fn() like mockGoToRoom) so the
hook used by useTryToJumpToThreadMessage is replaced, then in this test assert
mockGoToRoom was not called; keep the existing assertions that
mockedRoomHistoryManager.getSurroundingMessages and .getMore were not called and
ensure the endpointSpy expectation remains.
- Around line 48-90: Add a positive-path test for useTryToJumpToThreadMessage:
when the router search parameter includes msg (e.g., { msg: 'msg-1' }) and
jumpContext is absent or not 'jumpToUnread', mock the GET /v1/chat.getMessage
endpoint to return a thread message and stub goToRoom, then assert the endpoint
was called with { msgId: 'msg-1' }, that goToRoom was invoked with the
message.rid and routeParamsOverrides including tab: 'thread' and context equal
to the message.tmid (use the goToRoom spy), and that
mockedRoomHistoryManager.getSurroundingMessages or getMore were called to load
the messages; use the existing renderHook + mockAppRoot setup and waitFor to
await async behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3d7e3e35-211a-41bd-af47-2f18a31da6f2
📒 Files selected for processing (1)
apps/meteor/client/views/room/MessageList/hooks/useTryToJumpToThreadMessage.spec.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). (3)
- GitHub Check: cubic · AI code reviewer
- GitHub Check: CodeQL-Build
- GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{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/MessageList/hooks/useTryToJumpToThreadMessage.spec.ts
**/*.spec.ts
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.spec.ts: Use descriptive test names that clearly communicate expected behavior in Playwright tests
Use.spec.tsextension for test files (e.g.,login.spec.ts)
Files:
apps/meteor/client/views/room/MessageList/hooks/useTryToJumpToThreadMessage.spec.ts
🧠 Learnings (7)
📚 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/MessageList/hooks/useTryToJumpToThreadMessage.spec.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/MessageList/hooks/useTryToJumpToThreadMessage.spec.ts
📚 Learning: 2026-02-24T19:22:48.358Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/omnichannel/omnichannel-send-pdf-transcript.spec.ts:66-67
Timestamp: 2026-02-24T19:22:48.358Z
Learning: In Playwright end-to-end tests (e.g., under apps/meteor/tests/e2e/...), prefer locating elements by translated text (getByText) and ARIA roles (getByRole) over data-qa attributes. If translation values change, update the corresponding test locators accordingly. Never use data-qa locators. This guideline applies to all Playwright e2e test specs in the repository and helps keep tests robust to UI text changes and accessible semantics.
Applied to files:
apps/meteor/client/views/room/MessageList/hooks/useTryToJumpToThreadMessage.spec.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/MessageList/hooks/useTryToJumpToThreadMessage.spec.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/MessageList/hooks/useTryToJumpToThreadMessage.spec.ts
📚 Learning: 2026-03-06T18:10:15.268Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/code/CodeBlock.spec.tsx:47-68
Timestamp: 2026-03-06T18:10:15.268Z
Learning: In tests (especially those using testing-library/dom/jsdom) for Rocket.Chat components, the HTML <code> element has an implicit ARIA role of 'code'. Therefore, screen.getByRole('code') or screen.findByRole('code') will locate <code> elements even without a role attribute. Do not flag findByRole('code') as invalid in reviews; prefer using the implicit role instead of adding role="code" unless necessary for accessibility.
Applied to files:
apps/meteor/client/views/room/MessageList/hooks/useTryToJumpToThreadMessage.spec.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/MessageList/hooks/useTryToJumpToThreadMessage.spec.ts
🧬 Code graph analysis (1)
apps/meteor/client/views/room/MessageList/hooks/useTryToJumpToThreadMessage.spec.ts (2)
apps/meteor/client/views/room/MessageList/hooks/useTryToJumpToThreadMessage.ts (1)
useTryToJumpToThreadMessage(12-61)apps/meteor/app/ui-utils/client/lib/RoomHistoryManager.ts (1)
RoomHistoryManager(357-357)
🔇 Additional comments (2)
apps/meteor/client/views/room/MessageList/hooks/useTryToJumpToThreadMessage.spec.ts (2)
1-46: LGTM!
48-60: LGTM!
gabriellsh
left a comment
There was a problem hiding this comment.
Noticed the following situation:
- Open a DM between user A and B
- Start a thread with user A
- Read the messages and thead with user B, then switch rooms.
- With user A, send another message in the thread, with "Also send to channel" marked
- With user A, flood the main room with enough messages to fill the page so the unread bubble appears for user B
- With user B, go back to the room and click the unread bubble
- No scroll happens, but messages are marked as read (the thread message isn't marked as read, but I think that's the proper behavior since the thread shouldn't open)
Co-authored-by: Douglas Gubert <douglas.gubert@gmail.com> Co-authored-by: Julio Araujo <julio.araujo@rocket.chat>
There was a problem hiding this comment.
2 issues found across 4 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
There was a problem hiding this comment.
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 145-147: The cleanup predicate is inverted: currently it clears
msgJumpParam when the target message exists; change the condition in
ThreadMessageList so it clears only when the target message is missing. Replace
the if using messages.find((m) => m._id === msgJumpParam) && mainMessage._id !==
msgJumpParam with the inverted check: if (!messages.find((m) => m._id ===
msgJumpParam) && mainMessage._id !== msgJumpParam) {
setMessageJumpQueryStringParameter(null); } to remove stale ?msg= values
correctly.
🪄 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: fa1e6c92-1248-4af8-b6ca-af7cb396a873
📒 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). (2)
- GitHub Check: 📦 Build Packages
- 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
🔇 Additional comments (1)
apps/meteor/client/views/room/contextualBar/Threads/components/ThreadMessageList.tsx (1)
15-15: LGTM!Also applies to: 76-79, 108-111, 134-134
Proposed changes (including videos or screenshots)
Issue(s)
CORE-2221
CORE-2214
Steps to test or reproduce
Further comments
Summary by CodeRabbit
Bug Fixes
Tests