Files
buzz/desktop/tests
npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7andWill Pfleger 2d91b6f958 perf(views): cut synchronous first-render cost on channel, inbox, and agents mounts
The three nav-beachball view transitions were dominated by main-thread
first-render work on mount, not chunk-load or data-stall. Each surface
had redundant or eagerly-executed work removable without deferral:

- Channel: buildVideoReviewCommentsByRootId walked the full message list
  twice per mount (ChannelPane + TimelineMessageList), O(N^2) in the
  ancestor walk and unconditional even in channels with no video.
  TimelineMessageList now gates the whole-map build behind
  messages.some(hasVideoAttachment); ChannelPane builds a single root's
  comments on demand. resolvedAgentPubkeys and channelNames were rebuilt
  per visible row (identical across rows) — hoisted to the list,
  memoized for stable refs, and added to MessageRow's memo comparator so
  the hoist doesn't defeat its memoization.
- Inbox: InboxMessageRow re-parsed markdown on every HomeView re-render.
  Wrapped in React.memo with a field-level comparator — its callbacks
  are recreated inline by HomeView, so a reference comparator would be
  inert; it compares the render-affecting message fields instead.
- Agents: 14 invisible dialogs mounted unconditionally, executing their
  queries and hooks while closed. Conditionally rendered on each
  dialog's own open-state, removing closed-dialog work from the mount
  path. Each dialog mounts already-open; Radix drives its enter
  transition off data-state on first commit (covered by a tracked
  behavioral test).
- Closed the AgentsView double-lazy preload gap: preloadAgentsScreen now
  warms the inner AgentsView chunk too, so the first agents navigation
  doesn't hit a cold chunk. The dynamic import keeps AgentsView its own
  chunk rather than collapsing it into the index bundle.

Measured before/after (median of 3 runs, 4x CPU throttle): script
duration dropped on every surface (channel first -63ms, channel switch
-60ms, inbox -23ms, agents -32ms).

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
2026-06-22 23:08:07 -04:00
..