RocketChat / RocketChat/Rocket.Chat
Sidebar search triggers spotlight RPC for empty/whitespace queries
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Issue: Empty sidebar search should not call spotlight
Summary
When the sidebar search input is empty (or only contains spaces), the client still calls the spotlight method if the local result set is smaller than the configured limit.
This causes unnecessary server load and can return broad result sets that are not useful while the user has not typed a search term.
Impact
- Extra
spotlighttraffic from idle/empty searches. - Increased backend workload during frequent search focus/open interactions.
- Potentially noisy or unexpected results before the user provides intent.
Steps to reproduce
- Open the workspace sidebar search.
- Keep the query empty (or enter only whitespace).
- Observe network/method activity.
spotlightis invoked despite no meaningful term being provided.
Expected behavior
- Empty or whitespace-only searches should return local rooms only.
- The
spotlightmethod should be called only when there is a non-empty normalized term.
Proposed fix
Normalize the query term with trim() and short-circuit the queryFn to return localRooms when the normalized value is empty.
Status
Addressed in this branch by updating:
apps/meteor/client/navbar/NavBarSearch/hooks/useSearchItems.ts
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 in apps/meteor/client/navbar/NavBarSearch/hooks/useSearchItems.ts and inspect the queryFn used by the sidebar search. Verify that the query is normalized before deciding whether to call spotlight. Done means empty or whitespace-only queries return localRooms without invoking spotlight, while non-empty terms retain the existing search behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100