fix: guard against missing ts in lastMessage on Channel Directory#40519
fix: guard against missing ts in lastMessage on Channel Directory#40519SiddhiPandey08 wants to merge 1 commit into
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 |
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📜 Recent review details🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx,js}📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
Files:
🧠 Learnings (2)📚 Learning: 2026-03-27T14:52:56.865ZApplied to files:
📚 Learning: 2026-05-06T12:21:44.083ZApplied to files:
🔇 Additional comments (1)
WalkthroughChannelsTableRow now validates that ChangesTimestamp Safety in Directory
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ 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.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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.
Pull request overview
Fixes a UI crash in the Channel Directory caused by attempting to format a missing lastMessage.ts timestamp when lastMessage contains reactions but no ts.
Changes:
- Adds a guard before calling
formatDatefor the “Last Message” column in the channels directory table.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| {mediaQuery && ( | ||
| <GenericTableCell fontScale='p2' color='hint' withTruncatedText> | ||
| {lastMessage && formatDate(lastMessage.ts)} | ||
| {lastMessage?.ts && formatDate(lastMessage.ts)} |
Proposed changes (including videos or screenshots)
The Channel Directory was crashing with
RangeError: Invalid time valuewhen a channel's lastMessage contained a reactions object but no ts field.
Fixed by adding optional chaining on
lastMessage.tsbefore callingformatDatein ChannelsTableRow.tsx line 50.Before: {lastMessage && formatDate(lastMessage.ts)}
After: {lastMessage?.ts && formatDate(lastMessage.ts)}
Issue(s)
Closes #40503
Steps to test or reproduce
Further comments
Summary by CodeRabbit