Skip to content

fix: safely access lastMessage timestamp in ChannelsTableRow#40504

Open
melegiul wants to merge 1 commit into
RocketChat:developfrom
verdigado:fix/last-message-frontend-error
Open

fix: safely access lastMessage timestamp in ChannelsTableRow#40504
melegiul wants to merge 1 commit into
RocketChat:developfrom
verdigado:fix/last-message-frontend-error

Conversation

@melegiul
Copy link
Copy Markdown

@melegiul melegiul commented May 13, 2026

Proposed changes (including videos or screenshots)

Checks for presence of the last message timestamp before formating

Issue(s)

#40503

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue where the last message timestamp in the channels directory could fail to display correctly in certain conditions, ensuring timestamps now render reliably when available.

Review Change Stack

Review Change Stack

@melegiul melegiul requested a review from a team as a code owner May 13, 2026 09:53
@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot Bot commented May 13, 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

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 13, 2026

CLA assistant check
All committers have signed the CLA.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 13, 2026

⚠️ No Changeset found

Latest commit: ee6f3bc

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 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 85b06840-f78c-4b62-aa27-c289970a8299

📥 Commits

Reviewing files that changed from the base of the PR and between ee6f3bc and 22770ac.

📒 Files selected for processing (1)
  • apps/meteor/client/views/directory/tabs/channels/ChannelsTable/ChannelsTableRow.tsx
📜 Recent review details
🧰 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/directory/tabs/channels/ChannelsTable/ChannelsTableRow.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/directory/tabs/channels/ChannelsTable/ChannelsTableRow.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/directory/tabs/channels/ChannelsTable/ChannelsTableRow.tsx
🔇 Additional comments (1)
apps/meteor/client/views/directory/tabs/channels/ChannelsTable/ChannelsTableRow.tsx (1)

50-50: LGTM!


Walkthrough

The ChannelsTableRow component now uses optional chaining to check specifically for the lastMessage?.ts timestamp field when rendering a formatted date, instead of checking whether the lastMessage object exists.

Changes

Last message timestamp rendering condition

Layer / File(s) Summary
Last message timestamp rendering condition
apps/meteor/client/views/directory/tabs/channels/ChannelsTable/ChannelsTableRow.tsx
Changed the condition from lastMessage to lastMessage?.ts to narrow the check to the timestamp field itself, ensuring the formatted date renders only when the timestamp exists.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Suggested labels

type: bug

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and concisely describes the main change: safely accessing the lastMessage timestamp in ChannelsTableRow to prevent errors.
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.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

@melegiul melegiul force-pushed the fix/last-message-frontend-error branch from ee6f3bc to 22770ac Compare May 13, 2026 10:06
@coderabbitai coderabbitai Bot removed the type: bug label May 13, 2026
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