Skip to content

feat: debounce TUI rendering to 30fps#505

Merged
avoidwork merged 2 commits into
mainfrom
feat/debounce-tui-rendering
Jul 2, 2026
Merged

feat: debounce TUI rendering to 30fps#505
avoidwork merged 2 commits into
mainfrom
feat/debounce-tui-rendering

Conversation

@avoidwork

@avoidwork avoidwork commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Description

Replaced uncontrolled message mutations with a ref-based render tick. Messages are batched into messagesRef and the UI re-renders at a fixed ~30fps interval, preventing excessive React tree churn during streaming.

Type of Change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor (no functional changes)
  • Performance improvement
  • CI / build / tooling

Testing

  • All 1082 tests pass

Coverage

  • Line coverage maintained

Checklist

  • npm run lint passes
  • Tests pass with maintained line coverage
  • No forbidden patterns used
  • Conventional Commit style applied

avoidwork added 2 commits July 2, 2026 18:10
Replace useState with useRef for messages and add a 30fps render
interval. All setMessages calls replaced with direct ref mutations.
This batches streaming updates into a single render per frame,
reducing unnecessary re-renders during message streaming.
The render tick state was incremented but never read in JSX, so React
had no reason to re-render when messages changed. Adding key={renderTick}
to ConversationPanel forces a re-mount each tick, picking up the latest
messagesRef.current and displaying user messages immediately on submit.
@avoidwork avoidwork changed the title refactor: debounce TUI rendering to 30fps fix: force TUI re-render on message update via renderTick key Jul 2, 2026
@avoidwork avoidwork changed the title fix: force TUI re-render on message update via renderTick key fix: debounce TUI rendering to 30fps and fix message display Jul 2, 2026
@avoidwork avoidwork changed the title fix: debounce TUI rendering to 30fps and fix message display feat: debounce TUI rendering to 30fps Jul 2, 2026
@avoidwork avoidwork merged commit b121784 into main Jul 2, 2026
2 checks passed
@avoidwork avoidwork deleted the feat/debounce-tui-rendering branch July 2, 2026 22:37
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.

1 participant