The TUI response rendering feels sluggish compared to Claude Code. Text appears in visible jumps and scrolling is jerky during LLM streaming.
Root cause: The <markdown> element re-lays out block elements (headers, code blocks, lists) on every token delta, causing layout height shifts that make stickyScroll jump.
Solution: Add ALTIMATE_SMOOTH_STREAMING feature flag that:
- Uses
<code filetype="markdown"> during streaming (syntax colors without layout-shifting block elements), swaps to <markdown> after completion
- Pre-merges consecutive delta events in the SDK batch window
- Uses direct store path updates instead of
produce() proxy
- Reduces scroll-to-bottom latency from 50ms to 0ms
- Memoizes
trim() in TextPart to avoid redundant string scans
The TUI response rendering feels sluggish compared to Claude Code. Text appears in visible jumps and scrolling is jerky during LLM streaming.
Root cause: The
<markdown>element re-lays out block elements (headers, code blocks, lists) on every token delta, causing layout height shifts that make stickyScroll jump.Solution: Add
ALTIMATE_SMOOTH_STREAMINGfeature flag that:<code filetype="markdown">during streaming (syntax colors without layout-shifting block elements), swaps to<markdown>after completionproduce()proxytrim()in TextPart to avoid redundant string scans