Repository navigation
Stop the 700ms stream tick from re-rendering all three main panes (#91) - #120
Merged
currentbits merged 1 commit intoAug 16, 2026
Merged
Conversation
A run pushes thread:updated every 700ms. The handler mapped a fresh threads array per push and replaced the open detail, so App re-rendered Sidebar + ThreadView + AgentsPanel — ~7,400 lines of components, plus auto-animate in the sidebar — on every tick of every streaming thread. Split what each subscriber actually consumes: - patchThreadList keeps the array AND row identity when the pushed summary did not move, so a tick that only grew the transcript never touches the list. - mergeThreadPatch keeps the previous thread/usage objects when they are structurally equal, so a rebuilt-but-identical object does not invalidate the panes or effects keyed on them. - Sidebar, ThreadView and AgentsPanel are memo'd, and App now holds every handler stable for that to bite. ThreadView takes the resolved handoffSource and AgentsPanel a rosterKey instead of the whole list, whose identity churns by design. cancelQueued stays wrapped: it is bound straight to a button's onClick and its optional threadId would swallow the DOM event. Co-Authored-By: Claude Opus 5 <[email protected]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
currentbits
deleted the
coder/700ms-streaming-tick-re-renders-all-thre-f41da5
branch
October 3, 2026 16:07
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.
Fixes #91.
The problem
A run pushes
thread:updatedevery 700ms (tickMs, electron/main.js:284). The renderer's handler mapped a freshthreadsarray on every push and replaced the opendetail, soAppre-renderedSidebar+ThreadView+AgentsPanel— ~7,400 lines of components, on top of auto-animate in the sidebar — on every tick of every streaming thread. Fine with one thread; with five concurrent streams it is a constant render storm. OnlyMarkdownandMessageBlockwere memoized.What changed
Split what each subscriber of that one push actually consumes:
patchThreadList(src/threadPatch.ts) replaces the pushed row but keeps the array and row identity when the summary did not move. A tick that only grew the transcript — tool still running, waiting on a permission prompt — now never touches the list, so it costs nothing above the wire.mergeThreadPatchkeeps the previousthread/usageobjects when they are structurally equal, so a rebuilt-but-identical object no longer invalidates the panes (or effects keyed on them).Sidebar,ThreadViewandAgentsPanelarememo'd, andAppnow holds every handler stable — that is the half without which the memo does nothing.ThreadViewtakes the resolvedhandoffSource(its only use of the list was onefind) andAgentsPaneltakes arosterKeystring (which it was already deriving internally). The array's identity churns by design; either pane holding it would defeat its own memo.Comparison is
JSON.stringify: the payloads are small and already JSON-shaped across the IPC boundary, and a false "changed" only costs a render — it can never show a stale view.Net effect: a quiet background stream re-renders nothing, an appending one re-renders the sidebar only, and the open thread re-renders
ThreadViewonly.Note
onCancelQueuedstays wrapped rather than passed through. It is bound straight to a button'sonClick, socancelQueued's optionalthreadIdwould swallow the DOM event and cancel nothing — the existing suite caught this.Checks
npm run typecheck— cleannpm run build— cleannpm run test:renderer— 700/700 passNew unit coverage in test/threadPatch.test.ts for both identity guarantees; test/teamView.test.tsx updated for the
rosterKeyprop.PR created by the Claude Code agent