fix(dashboard): memoise chat feed + rails to kill input-typing lag#729
Merged
Conversation
Reported in #721: typing in the dashboard composer feels laggy on long sessions. Root cause is that every keystroke commits to `input` state, which forces ChatPanel to walk its entire vnode tree on each frame. ChatMessage was already wrapped in memo (#560), so historical bubbles short-circuit individually — but Preact still has to map() over every message, evaluate the per-row `Boolean(streaming && streaming.id === m.id)` discriminator, and diff each ChatMessage element. For a session with 100+ messages the per-keystroke work is enough to drop frames. Move the message-list render into a `<ChatFeed>` sub-component and wrap it in memo. With `messages` and `streaming` refs both stable while the user is typing, memo bails the whole feed out — keystrokes no longer touch the feed at all. SideRail and ChatStatusBar get the same treatment so /overview poll churn and input edits don't repaint the right-rail progress bars and statusbar. Closes #721
ChasLui
pushed a commit
to ChasLui/DeepSeek-Reasonix
that referenced
this pull request
May 23, 2026
…sengine#729) Reported in esengine#721: typing in the dashboard composer feels laggy on long sessions. Root cause is that every keystroke commits to `input` state, which forces ChatPanel to walk its entire vnode tree on each frame. ChatMessage was already wrapped in memo (esengine#560), so historical bubbles short-circuit individually — but Preact still has to map() over every message, evaluate the per-row `Boolean(streaming && streaming.id === m.id)` discriminator, and diff each ChatMessage element. For a session with 100+ messages the per-keystroke work is enough to drop frames. Move the message-list render into a `<ChatFeed>` sub-component and wrap it in memo. With `messages` and `streaming` refs both stable while the user is typing, memo bails the whole feed out — keystrokes no longer touch the feed at all. SideRail and ChatStatusBar get the same treatment so /overview poll churn and input edits don't repaint the right-rail progress bars and statusbar. Closes esengine#721
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Typing in the dashboard composer feels laggy on long sessions (#721).
Every keystroke commits to
inputstate, so ChatPanel re-renders andPreact walks its entire vnode tree on each frame — the message list,
the side rail, and the status bar.
ChatMessagewas already memoised in #560 so historical bubblesshort-circuit individually, but Preact still has to
.map()over everymessage, evaluate the per-row
Boolean(streaming && streaming.id === m.id)discriminator, and diff each element. On a session with 100+ messages,
the per-keystroke work is enough to drop frames.
Fix
<ChatFeed>sub-component and wrap itin
memo. While the user types,messagesandstreamingrefs arestable, so memo bails the whole feed out — keystrokes no longer
touch the feed.
SideRailandChatStatusBarinmemofor the same reason —/overview poll churn and input edits won't repaint progress bars or
the statusbar between actual state changes.
Closes #721
Test plan
in the composer, confirm typing is responsive.
feedRefpassedthrough
innerRef).re-renders when
streamingref changes per rAF flush)./overviewpoll keeps refreshing status bar / side rail valuesevery 2.5s.