Skip to content

Thread search delay due to double debounce and filter switching causes layout inconsistency #38006

@dodaa08

Description

@dodaa08

Description:

Thread search has two performance issues:

  1. Double Debounce Delay (700ms): Search text is debounced for 400ms, then the options object is debounced again for 300ms, resulting in a 700ms total delay before API calls.

  2. Layout Inconsistency: When switching between "All", "Following", and "Unread" filters, the loading spinner appears as a sibling element, causing the list container to resize and create a visible UI shake.

Steps to reproduce:

  1. Open Threads sidebar in any room
  2. Type in search box - observe ~700ms delay
  3. Switch filters rapidly (All → Following → Unread)
  4. Notice UI shake when loading spinner appears

Expected behavior:

  • Search responds in 400ms after typing stops
  • Filter switching is instant
  • No UI shake or layout changes during filter transitions

Actual behavior:

Screen recordings attached showing both issues

  • UI shake/jump visible when switching filters
WhatsApp.Video.2025-12-29.at.10.23.43.PM.mp4

and

  • ~700ms delay before search results appear
Screencast.From.2025-12-30.00-44-55.mp4

Server Setup Information:

  • Version of Rocket.Chat Server: 8.0 (tested on open.rocket.chat)
  • Operating System: Fedora Linux 43
  • Deployment Method: Rocket chat demo instance open.rocket.chat

Client Setup Information

  • Desktop App or Browser Version: Brave
  • Operating System: Fedora Linux 43

Additional context:

Image
  • similar components (useDirectoryQuery, useQuery) also use useDebouncedValue(useMemo(...)) pattern
  • However, ThreadList is different: it debounces text separately (400ms) THEN debounces the options object (300ms)
  • Affects all thread search users

Relevant logs:

  • Browser: No console errors. Network shows ~700ms delay.
  • Server: No errors.

Note: I'm working on a fix for this issue and will submit a PR with the solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions