RocketChat / RocketChat/Rocket.Chat
Home navbar search fails when search term contains leading or trailing whitespace
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description:
The Home navbar search (Ctrl + K) does not return expected results when the search term contains leading or trailing whitespace.
For example, searching for general successfully finds the channel, but searching for general, general , or general returns no results. The same behavior is observed when searching for channels (#) and direct messages (@).
This causes valid searches to fail if users accidentally enter extra spaces before or after the search term.
Steps to reproduce:
- Open the Home navbar search (Ctrl + K).
- Search for an existing channel or user (e.g.
generalor@username). - Repeat the search with leading or trailing whitespace, for example:
generalgeneralgeneral# general@username
- Observe the search results.
Expected behavior:
Leading and trailing whitespace should be ignored, and the search should return the same results as the trimmed search term.
Actual behavior:
The search treats surrounding whitespace as part of the query, causing valid channels and users not to appear in the search results.
Server Setup Information:
- Version of Rocket.Chat Server: 8.8.0-develop
- License Type: Community
- Number of Users: N/A
- Operating System: Ubuntu 24.04 (WSL2)
- Deployment Method: Development
- Number of Running Instances: 1
- DB Replicaset Oplog: Enabled
- NodeJS Version: 22.22.3
- MongoDB Version: 7.0.16
Client Setup Information
- Desktop App or Browser Version: Google Chrome (latest)
- Operating System: Windows 11
Additional context
This issue is reproducible with:
- Channel searches
- Direct message searches
- Searches with leading whitespace
- Searches with trailing whitespace
- Searches with both leading and trailing whitespace
Examples:
| Search | Result |
|---|---|
general |
✅ Found |
general |
❌ Not found |
general |
❌ Not found |
general |
❌ Not found |
#general |
✅ Found |
# general |
❌ Not found |
@username |
✅ Found |
@username |
❌ Not found |
Relevant logs:
No relevant server or browser errors are produced. The issue is reproducible consistently through normal UI interaction.
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 by reproducing the issue in the Home navbar search with the listed channel and direct-message queries, then trace the search input handling from that UI entry point. The work is done when leading and trailing whitespace is ignored and the trimmed, prefixed, and unprefixed examples return the same results as their clean queries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100