-
Notifications
You must be signed in to change notification settings - Fork 12.9k
fix(sidebar): update room avatar in real-time #38047
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
fix(sidebar): update room avatar in real-time #38047
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 Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughThis PR updates two room-related components to propagate Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 issues found across 2 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="apps/meteor/client/sidebar/RoomList/SidebarItemWithData.tsx">
<violation number="1" location="apps/meteor/client/sidebar/RoomList/SidebarItemWithData.tsx:178">
P2: Duplicate `avatarETag` check. This condition is already checked a few lines above and will never be reached when the values differ. Remove this duplicate block.</violation>
</file>
<file name="apps/meteor/client/components/RoomIcon/RoomIcon.tsx">
<violation number="1" location="apps/meteor/client/components/RoomIcon/RoomIcon.tsx:10">
P2: Remove commented-out code. This appears to be the old implementation left in during development - it duplicates the active code and adds maintenance burden.</violation>
<violation number="2" location="apps/meteor/client/components/RoomIcon/RoomIcon.tsx:43">
P2: Inconsistent indentation: the new code uses spaces but this codebase uses tabs. This will likely cause linting failures or merge conflicts.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (1)
apps/meteor/client/components/RoomIcon/RoomIcon.tsx (1)
48-55: Remove inline comments per coding guidelines.As per coding guidelines for
**/*.{ts,tsx,js}files, avoid code comments in the implementation. The type change is self-explanatory.🔎 Proposed fix
}: { - // Add avatarETag here so the component tracks it room: Pick<IRoom, 't' | 'prid' | 'teamMain' | 'uids' | 'u' | 'avatarETag'>; size?: ComponentProps<typeof Icon>['size']; isIncomingCall?: boolean; placement?: 'sidebar' | 'default'; }): ReactElement | null => { - // Passing the room with the avatarETag into the hook const iconPropsOrReactNode = useRoomIcon(room);
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
apps/meteor/client/components/RoomIcon/RoomIcon.tsxapps/meteor/client/sidebar/RoomList/SidebarItemWithData.tsx
🧰 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/components/RoomIcon/RoomIcon.tsxapps/meteor/client/sidebar/RoomList/SidebarItemWithData.tsx
🧠 Learnings (3)
📚 Learning: 2025-10-28T16:53:42.761Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 37205
File: ee/packages/federation-matrix/src/FederationMatrix.ts:296-301
Timestamp: 2025-10-28T16:53:42.761Z
Learning: In the Rocket.Chat federation-matrix integration (ee/packages/federation-matrix/), the createRoom method from rocket.chat/federation-sdk will support a 4-argument signature (userId, roomName, visibility, displayName) in newer versions. Code using this 4-argument call is forward-compatible with planned library updates and should not be flagged as an error.
Applied to files:
apps/meteor/client/components/RoomIcon/RoomIcon.tsx
📚 Learning: 2025-11-17T15:07:13.273Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37398
File: packages/fuselage-ui-kit/src/surfaces/FuselageSurfaceRenderer.tsx:357-363
Timestamp: 2025-11-17T15:07:13.273Z
Learning: In packages/fuselage-ui-kit/src/surfaces/FuselageSurfaceRenderer.tsx, IconElement is a presentational, non-actionable element that does not require wrapping in AppIdProvider, similar to plain_text and mrkdwn renderers. Only actionable elements (those with actions, actionId, or interactive behavior) should be wrapped in AppIdProvider.
Applied to files:
apps/meteor/client/components/RoomIcon/RoomIcon.tsx
📚 Learning: 2025-12-18T15:18:31.688Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37773
File: apps/meteor/client/views/mediaCallHistory/MediaCallHistoryInternal.tsx:24-34
Timestamp: 2025-12-18T15:18:31.688Z
Learning: In apps/meteor/client/views/mediaCallHistory/MediaCallHistoryInternal.tsx, for internal call history items, the item.contactId is guaranteed to always match either the caller.id or callee.id in the call data, so the contact resolution in getContact will never result in undefined.
Applied to files:
apps/meteor/client/sidebar/RoomList/SidebarItemWithData.tsx
🧬 Code graph analysis (2)
apps/meteor/client/components/RoomIcon/RoomIcon.tsx (2)
apps/meteor/client/hooks/useRoomIcon.tsx (1)
useRoomIcon(8-57)packages/core-typings/src/IRoom.ts (1)
isOmnichannelRoom(333-333)
apps/meteor/client/sidebar/RoomList/SidebarItemWithData.tsx (1)
packages/core-typings/src/IRoom.ts (1)
isOmnichannelRoom(333-333)
⏰ 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). (1)
- GitHub Check: cubic · AI code reviewer
🔇 Additional comments (1)
apps/meteor/client/sidebar/RoomList/SidebarItemWithData.tsx (1)
163-212: Approve the core fix for avatar updates.Adding the
avatarETagcomparison to the memo function correctly ensures the sidebar item re-renders when the room avatar changes. This, combined with theRoomIconprop type update, addresses the original issue where avatar changes weren't reflected in the sidebar.
Proposed changes
This PR fixes an issue where updating a room/channel avatar would reflect in the Room Header and Room Info panel, but not in the Sidebar until a manual refresh.
The issue was caused by:
SidebarItemWithData.tsxusing amemocomparison that ignoredavatarETagchanges, preventing re-renders.RoomIcon.tsxprop types excludingavatarETag, which prevented the component from tracking avatar version updates.Checklist
avatarETagis correctly used to bust the browser cache for the new image.Steps to test
closes #37913
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.