Description
Typing in the Buddy composer becomes noticeably delayed after a long conversation has accumulated.
Steps to Reproduce
- Open the Buddy.
- Continue the conversation until a large number of messages and actions are displayed.
- Type continuously in the composer.
- Compare the input responsiveness with a new or short conversation.
Expected Behavior
The composer remains responsive regardless of conversation length, and typing does not rerender the complete conversation history.
Actual Behavior
Input updates become increasingly delayed as the conversation grows.
Affected Component
Frontend
Environment
No response
Possible Cause
Confirmed by code review: the composer's draft state and the full messages array live in the same hook (useBuddyConversation.ts), whose return value is a new object on every render. That hook is instantiated once in BuddyProvider.tsx and passed straight into a React Context, so every keystroke produces a new context value and re-renders every consumer, including the full message list. Neither BuddyThread.tsx nor BuddyMessage.tsx is wrapped in React.memo (unlike the analogous chat feature's MessageRow, which is memoized specifically to isolate re-renders), and there is no list virtualization library in use. Fixing this means isolating composer/draft state from the message-list state (e.g. a separate context or a memoized message list) rather than profiling from scratch.
Description
Typing in the Buddy composer becomes noticeably delayed after a long conversation has accumulated.
Steps to Reproduce
Expected Behavior
The composer remains responsive regardless of conversation length, and typing does not rerender the complete conversation history.
Actual Behavior
Input updates become increasingly delayed as the conversation grows.
Affected Component
Frontend
Environment
No response
Possible Cause
Confirmed by code review: the composer's
draftstate and the fullmessagesarray live in the same hook (useBuddyConversation.ts), whose return value is a new object on every render. That hook is instantiated once inBuddyProvider.tsxand passed straight into a React Context, so every keystroke produces a new context value and re-renders every consumer, including the full message list. NeitherBuddyThread.tsxnorBuddyMessage.tsxis wrapped inReact.memo(unlike the analogous chat feature'sMessageRow, which is memoized specifically to isolate re-renders), and there is no list virtualization library in use. Fixing this means isolating composer/draft state from the message-list state (e.g. a separate context or a memoized message list) rather than profiling from scratch.