Skip to content

Comments

fix: avatar resize issue in users directory table#38538

Open
Khizarshah01 wants to merge 2 commits intoRocketChat:developfrom
Khizarshah01:fix/users-table-avatar-shrink
Open

fix: avatar resize issue in users directory table#38538
Khizarshah01 wants to merge 2 commits intoRocketChat:developfrom
Khizarshah01:fix/users-table-avatar-shrink

Conversation

@Khizarshah01
Copy link
Contributor

@Khizarshah01 Khizarshah01 commented Feb 7, 2026

Proposed changes (including videos or screenshots)

Fixed an issue where user avatars in the Directory > Users table would shrink incorrectly when the screen width was reduced or when usernames were very long.

Changes made:

  • Refactored UsersTableRow.tsx to use the same Flexbox implementation as the Admin > Users table.
  • Added withTruncatedText to the GenericTableCell, same as Admin> Users table, consistent overflow handling.

This ensures avatars maintain a fixed size regardless of screen width or text length, aligning the behaviour with the Admin view.

Issue(s)

fixes #38536

Steps to test or reproduce

  1. Go to Directory > Users tab.
  2. Resize the browser window to a smaller width or use a long username and name.
  3. Observe that the user avatars maintain their size and do not shrink.
  4. Observe that long usernames/names are properly truncated with an ellipsis (...).

Further comments

Before behaviour (buggy):

Screencast.from.2026-02-07.19-55-23.mp4

After behaviour (fixed):

Screencast.from.2026-02-07.20-01-37.mp4

Summary by CodeRabbit

  • Refactor
    • Redesigned the internal layout of user rows in the directory table for a cleaner, more maintainable UI structure. Avatars, names, nicknames, bios, truncation, and row click/keyboard interactions are preserved; visual appearance and behavior remain unchanged. Alignment and text truncation logic adjusted to improve consistency and make future styling updates easier.

@Khizarshah01 Khizarshah01 requested a review from a team as a code owner February 7, 2026 15:49
@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Feb 7, 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

changeset-bot bot commented Feb 7, 2026

⚠️ No Changeset found

Latest commit: c2bc74f

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
Contributor

coderabbitai bot commented Feb 7, 2026

No actionable comments were generated in the recent review. 🎉

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a8122ae and c2bc74f.

📒 Files selected for processing (1)
  • apps/meteor/client/views/directory/tabs/users/UsersTable/UsersTableRow.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/meteor/client/views/directory/tabs/users/UsersTable/UsersTableRow.tsx
⏰ 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

Walkthrough

The UsersTableRow layout was refactored to replace nested Flex containers with a single Box-based flex wrapper; the text container now has explicit flexGrow/flexShrink/flexBasis to prevent avatar resizing, and the Bio MarkdownText was relocated as a sibling while preserving interaction handlers.

Changes

Cohort / File(s) Summary
Layout restructuring
apps/meteor/client/views/directory/tabs/users/UsersTable/UsersTableRow.tsx
Replaced nested Flex usage with a Box display='flex' wrapper. Wrapped Avatar in a non-flexing Box; added explicit flexGrow, flexShrink, and flexBasis to the text content Box to stop avatar shrinking. Moved Bio (MarkdownText) to a sibling element while retaining onClick/onKeyDown handlers and truncation behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hopped through lines and shifted rows,
Moved little boxes where the text now grows.
Avatars steady, names softly trimmed,
A tiny tweak — the layout grinned. 🥕

🚥 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 PR title clearly and concisely describes the main change: fixing the avatar resize issue in the users directory table.
Linked Issues check ✅ Passed The changes directly address all coding requirements from issue #38536: refactoring the layout to prevent avatar shrinking, maintaining fixed avatar size, adding text truncation with ellipsis, and aligning with Admin Users table implementation.
Out of Scope Changes check ✅ Passed All changes are focused on refactoring UsersTableRow.tsx to fix the avatar resize issue; no unrelated or out-of-scope modifications were introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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
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.

No issues found across 1 file

@Khizarshah01
Copy link
Contributor Author

Hi team 👋
When you get a chance, please take a look at this small UI fix. Thanks!

@Khizarshah01 Khizarshah01 force-pushed the fix/users-table-avatar-shrink branch from a15faef to b4f84fc Compare February 20, 2026 20:19
Copy link
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

🧹 Nitpick comments (1)
apps/meteor/client/views/directory/tabs/users/UsersTable/UsersTableRow.tsx (1)

37-38: Spurious {' '} expressions are no-ops inside a flex container.

Both {' '} expressions produce React text nodes that are treated as zero-width anonymous flex items — they have no visual effect in display='flex' context. They appear to be copy-paste artifacts and can be safely removed.

♻️ Proposed cleanup
 							<Box fontScale='p2m' withTruncatedText>
 								{name || username}
 								{nickname && ` (${nickname})`}
-							</Box>{' '}
-							<Box mi={4} />{' '}
+							</Box>
+							<Box mi={4} />
 							<Box fontScale='p2' color='hint' withTruncatedText>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/meteor/client/views/directory/tabs/users/UsersTable/UsersTableRow.tsx`
around lines 37 - 38, Remove the spurious React text nodes `{' '}` in
UsersTableRow.tsx that create zero-width flex items inside the flex container;
locate the Box elements around the spacing (e.g. the closing `</Box>` followed
by `{' '}` and the `<Box mi={4} />{' '}` instances) and delete the trailing `{'
'}` expressions so only the intended Box components remain.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 21974a8 and b4f84fc.

📒 Files selected for processing (1)
  • apps/meteor/client/views/directory/tabs/users/UsersTable/UsersTableRow.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/views/directory/tabs/users/UsersTable/UsersTableRow.tsx
🧬 Code graph analysis (1)
apps/meteor/client/views/directory/tabs/users/UsersTable/UsersTableRow.tsx (1)
packages/ui-client/src/components/GenericTable/GenericTableCell.tsx (1)
  • GenericTableCell (6-6)
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/meteor/client/views/directory/tabs/users/UsersTable/UsersTableRow.tsx`:
- Around line 30-32: The UserAvatar is not wrapped in a flex-constrained
container, so it can shrink unexpectedly; update UsersTableRow
(UsersTableRow.tsx) to wrap the conditional UserAvatar in a Box with flex
constraints (e.g., <Box flexGrow={0}>) similar to ChannelsTableRow.tsx and
TeamsTableRow.tsx, ensuring the avatar has fixed flex behavior while the
adjacent text container (the inner Box with flexShrink={1}) continues to handle
truncation.

---

Nitpick comments:
In `@apps/meteor/client/views/directory/tabs/users/UsersTable/UsersTableRow.tsx`:
- Around line 37-38: Remove the spurious React text nodes `{' '}` in
UsersTableRow.tsx that create zero-width flex items inside the flex container;
locate the Box elements around the spacing (e.g. the closing `</Box>` followed
by `{' '}` and the `<Box mi={4} />{' '}` instances) and delete the trailing `{'
'}` expressions so only the intended Box components remain.

@KevLehman KevLehman added the contrib: valid A valid contribution where maintainers will review based on priority label Feb 20, 2026
@Khizarshah01 Khizarshah01 force-pushed the fix/users-table-avatar-shrink branch 2 times, most recently from a8122ae to c2bc74f Compare February 22, 2026 19:37
Copy link
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.

🧹 Nitpick comments (1)
apps/meteor/client/views/directory/tabs/users/UsersTable/UsersTableRow.tsx (1)

37-38: Redundant {' '} text nodes inside a flex container.

{' '} text nodes have no visual effect when their parent is display='flex' — horizontal spacing is entirely controlled by the <Box mi={4} /> spacer. Remove them.

♻️ Proposed cleanup
-					</Box>{' '}
-					<Box mi={4} />{' '}
+					</Box>
+					<Box mi={4} />
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/meteor/client/views/directory/tabs/users/UsersTable/UsersTableRow.tsx`
around lines 37 - 38, Redundant {' '} text nodes inside the UsersTableRow JSX
create no visual spacing inside the flex container; remove the stray {' '} text
nodes surrounding the spacer <Box mi={4} /> in the UsersTableRow component so
spacing is handled solely by the <Box mi={4} /> element and ensure the
surrounding tags remain valid JSX after deletion.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b4f84fc and a8122ae.

📒 Files selected for processing (1)
  • apps/meteor/client/views/directory/tabs/users/UsersTable/UsersTableRow.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/views/directory/tabs/users/UsersTable/UsersTableRow.tsx
🧬 Code graph analysis (1)
apps/meteor/client/views/directory/tabs/users/UsersTable/UsersTableRow.tsx (1)
packages/ui-client/src/components/GenericTable/GenericTableCell.tsx (1)
  • GenericTableCell (6-6)
⏰ 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
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@apps/meteor/client/views/directory/tabs/users/UsersTable/UsersTableRow.tsx`:
- Around line 30-32: The avatar still can shrink because it isn't prevented from
flex-shrinking; wrap the UserAvatar element in a container with flexShrink={0}
(or set flexShrink={0} on the element that renders the avatar) so the avatar
never compresses when the parent Box (display='flex') is constrained—update the
JSX around the UserAvatar in UsersTableRow (the Box containing UserAvatar and
the adjacent text Box) to add a wrapper with flexShrink={0} for the avatar.

---

Nitpick comments:
In `@apps/meteor/client/views/directory/tabs/users/UsersTable/UsersTableRow.tsx`:
- Around line 37-38: Redundant {' '} text nodes inside the UsersTableRow JSX
create no visual spacing inside the flex container; remove the stray {' '} text
nodes surrounding the spacer <Box mi={4} /> in the UsersTableRow component so
spacing is handled solely by the <Box mi={4} /> element and ensure the
surrounding tags remain valid JSX after deletion.

@codecov
Copy link

codecov bot commented Feb 22, 2026

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.55%. Comparing base (dad0dba) to head (c2bc74f).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #38538      +/-   ##
===========================================
- Coverage    70.55%   70.55%   -0.01%     
===========================================
  Files         3189     3189              
  Lines       112703   112703              
  Branches     20429    20429              
===========================================
- Hits         79521    79520       -1     
+ Misses       31119    31118       -1     
- Partials      2063     2065       +2     
Flag Coverage Δ
e2e 60.26% <0.00%> (-0.12%) ⬇️
e2e-api 48.86% <ø> (+1.07%) ⬆️

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contrib: valid A valid contribution where maintainers will review based on priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent avatar resizing in Directory Users Table compared to Admin Table

2 participants