Skip to content

perf(chat): debounce @-mention search and memoize side panels#77

Merged
arnestrickmann merged 2 commits intogeneralaction:mainfrom
tomascupr:perf/chat-debounce-memo
Oct 3, 2025
Merged

perf(chat): debounce @-mention search and memoize side panels#77
arnestrickmann merged 2 commits intogeneralaction:mainfrom
tomascupr:perf/chat-debounce-memo

Conversation

@tomascupr
Copy link
Contributor

This PR addresses severe typing lag reported in large workspaces by reducing unnecessary computation and isolating re-renders.

Changes

  • Debounce @-mention file index search in ChatInput (120ms). Prevents running a 5k-item search on every keystroke.
  • Memoize right-side panels (FileChangesPanel, WorkspaceTerminalPanel) with React.memo to avoid re-rendering while typing in the chat.

Why

  • In large repos with many indexed entries and active polling, repeated synchronous searches and panel re-renders can cause multi-second input lag.
  • Debouncing and memoization keep the chat input smooth while preserving existing behavior.

Test Plan

  1. Open a large repository (thousands of files indexed).
  2. Type in the chat input without @: typing remains responsive.
  3. Type @ then some characters: suggestions appear after a brief pause (~120ms), arrow keys and Enter work to insert.
  4. Observe that the right panels do not flicker or re-render on every keystroke.

Notes

  • Scope is intentionally small and safe. No behavioral changes to file change polling or PR status.
  • Follow-ups: optionally pause polling during fast typing and consolidate Git status calls to further reduce load in gigantic repos.

…bounce file index search in ChatInput to reduce UI work while typing\n- Memoize FileChangesPanel and WorkspaceTerminalPanel to avoid unnecessary renders\n\nThis addresses severe typing lag in large repos by cutting redundant computation and isolating re-renders.\n\nTest plan:\n- Open a large repo (5k+ indexed entries)\n- Type in chat input with and without '@' mentions; typing remains responsive\n- Verify mention dropdown appears after brief pause and navigation works\n- Confirm right panels do not flicker or re-render on every keystroke\n
@arnestrickmann
Copy link
Contributor

thank you, @tomascupr - appreciate your contributions!

@arnestrickmann arnestrickmann merged commit e90069b into generalaction:main Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants