-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Description
Description:
The file search makes a new API request for every character typed, causing HTTP 429 (rate limit) errors that break the search functionality.
Steps to reproduce:
- Open file search in any channel with files
- Type search text (e.g., "Clipboard")
- Backspace to delete characters
- Observe: search results disappear and don't reload
Expected behavior:
- Search should wait ~300-500ms after user stops typing before making API request
- Results should reload properly after backspacing
- Rate limit errors should be handled gracefully
Actual behavior:
- Every keystroke triggers immediate API call
- Typing 9 characters = 9 separate API requests in rapid succession
- Requests hit rate limit (HTTP 429)
- UI shows blank results with no error message
- Search becomes unusable
Video:
Screencast.From.2025-12-25.10-21-31.mp4
Why This Happens:
The search input updates the query state immediately on every keystroke without any delay. This triggers the API to fetch new results instantly. When you type quickly (like "Clipboard"), it sends 9 API calls one after another, which exceeds the server's rate limit.
The issue is in apps/meteor/client/views/room/contextualBar/RoomFiles/RoomFilesWithData.tsx where the search text state directly triggers API calls without debouncing. The file needs to implement a delay mechanism (debouncing) so the API is only called after the user stops typing.
Environment:
- Version: 8.0 (tested on open.rocket.chat)
- Browser: Brave
- OS: Fedora Linux 43
Console Logs:
/api/v1/channels.files?name=C: Failed to load resource: status 429
/api/v1/channels.files?name=Cl: Failed to load resource: status 429
/api/v1/channels.files?name=Cli: Failed to load resource: status 429
Are you working on this?
✅ Yes, I am working on this.