RocketChat / RocketChat/Rocket.Chat
4.5.1 - Add user pane crashes when typing in a name (if display name isn't set?)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description:
As of the 4.5.1 update, clicking the blue "add users" button on a channel and typing in any username causes the pane to crash. One of our developers might have found the core issue, but i'll leave that at the bottom since its not verified.
Steps to reproduce:
- Go to any channel
- Click on the blue "add" button inside the members list in the top right
- When you start typing a name, the members pane crashes and you begin typing in the message box after the first character
Expected behavior:
The members list to be searched, so we can add people to channels!
Actual behavior:
Walk-through of screenshots:



After typing the letter J in John Smith, the pane crashes and the rest of the text ends up in the message box. Not limited to any one letter, any character will cause it to crash.
Server Setup Information:
- Version of Rocket.Chat Server: 4.5.1
- Operating System: Ubuntu server
- Deployment Method: snap
- Number of Running Instances: 1
- DB Replicaset Oplog:
- NodeJS Version: 14.18.3
- MongoDB Version: 4.2.17
Client Setup Information
- Desktop App or Browser Version: both
- Operating System: both windows 10 and ubuntu desktop
Additional context
I got this from a dev who was running into this issue and may have debugged it at the browser level. Can't verify if this is the core issue or not, but its definitely worth including. Some of our users don't have "firstname lastname" filled out in their profiles and just have usernames - so the report checks out.
Hi,
I can't add users to a private channel in RocketChat. I'm the channel
Moderator, but when I go to Members > Add and start typing in the Choose
users field, everything in the sidebar disappears and a browser console
error is thrown:
TypeError: Cannot read properties of undefined (reading 'toLowerCase')
The source of the error is that the code is trying to lowercase the
display name of users, but some users apparently haven't picked one yet
(or maybe have declined?).
See this screenshot which shows the array with some items having
undefined for a second item. Those items trigger the error.
Not sure if there's an issue for this tracked against the rocketchat
repo, but maybe we can update the users list to assign default display
names to people. They can change it, I think, through the UI in Account
Settings. However, can they also clear it again, making it undefined?,
or would it be an empty string (which would be ok).

The screenshot above probably provides a lot of insight, if that is is the issue.
Thanks!
-Connor
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Members > Add flow and reproduce the crash in the Choose users field with a user whose display name is unset. Trace the search filtering path that calls toLowerCase on the display name, then verify that typing a name no longer crashes the pane and still searches users for channel membership.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100