Skip to content

fix(dashboard): memoise chat feed + rails to kill input-typing lag#729

Merged
esengine merged 1 commit into
mainfrom
fix/dashboard-input-lag
May 13, 2026
Merged

fix(dashboard): memoise chat feed + rails to kill input-typing lag#729
esengine merged 1 commit into
mainfrom
fix/dashboard-input-lag

Conversation

@esengine

Copy link
Copy Markdown
Owner

Summary

Typing in the dashboard composer feels laggy on long sessions (#721).
Every keystroke commits to input state, so ChatPanel re-renders and
Preact walks its entire vnode tree on each frame — the message list,
the side rail, and the status bar.

ChatMessage was already memoised in #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 element. On a session with 100+ messages,
the per-keystroke work is enough to drop frames.

Fix

  • Lift the message list into a <ChatFeed> sub-component and wrap it
    in memo. While the user types, messages and streaming refs are
    stable, so memo bails the whole feed out — keystrokes no longer
    touch the feed.
  • Wrap SideRail and ChatStatusBar in memo for 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

  • Open dashboard with a long-running session (50+ messages), type
    in the composer, confirm typing is responsive.
  • Verify auto-scroll on new message still works (feedRef passed
    through innerRef).
  • Confirm streaming bubble still updates in real time (memo
    re-renders when streaming ref changes per rAF flush).
  • /overview poll keeps refreshing status bar / side rail values
    every 2.5s.
  • Language switch still updates feed empty-state text.

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
@esengine esengine merged commit 77d1674 into main May 13, 2026
3 checks passed
@esengine esengine deleted the fix/dashboard-input-lag branch May 13, 2026 03:06
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
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.

Dashboard has performance issues

1 participant