Skip to content

perf(desktop): memoize PlatformAvatar + StatusDot (messaging icon churn) - #73774

Merged
OutThisLife merged 1 commit into
mainfrom
bb/desktop-messaging-icon-churn
Jul 29, 2026
Merged

perf(desktop): memoize PlatformAvatar + StatusDot (messaging icon churn)#73774
OutThisLife merged 1 commit into
mainfrom
bb/desktop-messaging-icon-churn

Conversation

@OutThisLife

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #73698. That PR flagged three "not fixed" items; on re-measurement (settling each surface fully before starting the counter, instead of catching the mount cascade), only one was a real steady-state loop. This PR fixes it. The other two are documented below as non-issues so the record is straight.

The one real fix: messaging icon churn

The sidebar's messaging section renders, per platform group, one PlatformAvatar (as the section labelIcon) and a StatusDot. The whole ChatSidebar re-renders on every streaming tick — it subscribes to $sessions, $workingSessionIds, $messagingSessions, $messagingPlatformTotals, and ~16 other stores — and both icon components were unmemoized. So every platform's avatar and dot re-rendered on every stream delta despite their props (platformId, platformName, tone, className) never changing.

component fix
messaging/platform-icon.tsxPlatformAvatar memo(forwardRef(...)) — pure function of platformId/platformName/className/style. forwardRef preserved (Radix Tip asChild needs the ref, #67500).
components/status-dot.tsxStatusDot memo() — pure function of tone/className.

Metrics (Messaging open, settled 4s after mount, 2 sessions streaming, 3s window)

component before (wasted) after
PlatformAvatar 32 0
StatusDot 32 0
brand icons (SiTelegram2, etc.) + SectionTitle/ExternalLink ~32 0
total 96 0

Both are shared primitives, so the memo also removes the same per-tick churn wherever else they render under a hot parent — session rows, the gateway menu panel, session tiles.

The two that were NOT real loops (measured, no code needed)

Documenting these because #73698's description originally listed them as open — they aren't.

Verification

  • typecheck: clean
  • lint: 0 errors
  • tests: messaging/index.test.tsx, status-dot pass

Method note

The correction here is a measurement-discipline lesson worth recording: start the render counter only after a surface has settled. Measuring from the moment of navigation conflates the unavoidable one-time mount/data-load cascade with steady-state churn, and massively overstates the latter. The sidebar-bleed wins in #73698 are real (they reproduce on every stream tick, settled); the Artifacts "loop" was a mount-cascade artifact of measuring too early.

…hurn

The sidebar's messaging section renders one PlatformAvatar (labelIcon) and
StatusDot per platform group. The sidebar re-renders on every streaming tick
($sessions/$workingSessionIds/$messagingSessions churn), and both leaves were
unmemoized — so every platform's avatar + dot re-rendered on each delta even
though their props (platformId/tone/className) never changed.

- PlatformAvatar: memo(forwardRef(...)) — pure fn of platformId/name/class/style
- StatusDot: memo() — pure fn of tone/class

Measured (Messaging open, settled, 2 sessions streaming, 3s window):
  before: 96 wasted (PlatformAvatar 32, StatusDot 32, + brand icons)
  after:  0 wasted

Both are shared primitives; the memo also helps every other consumer
(session rows, gateway menu, session tiles) that renders them under a hot
parent.
@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on d76c7f5

ℹ️ Info

Desktop E2E visual evidence · View test artifacts · View job

1 visual diff.

inline evidence upload failed.

Failed to upload diff-665a0833239e-onboarding-overlay-diff.png with gh image (exit code 1): Error uploading /home/runner/work/_temp/e2e-evidence/diff-665a0833239e-onboarding-overlay-diff.png: step 0 (get upload token): uploadToken not found on repo page — do you have write access to NousResearch/hermes-agent? (or, if NousResearch enforces SAML SSO, authorize at https://github.com/orgs/NousResearch/sso)

@alt-glitch alt-glitch added type/perf Performance improvement or optimization P3 Low — cosmetic, nice to have comp/desktop Electron desktop app (apps/desktop/*) labels Jul 29, 2026
@OutThisLife
OutThisLife merged commit 533d633 into main Jul 29, 2026
36 checks passed
@OutThisLife
OutThisLife deleted the bb/desktop-messaging-icon-churn branch July 29, 2026 02:16
randlee pushed a commit to randlee/hermes-agent that referenced this pull request Aug 11, 2026
…ssaging-icon-churn

perf(desktop): memoize PlatformAvatar + StatusDot (messaging icon churn)
33hodl pushed a commit to 33hodl/hermes-agent that referenced this pull request Aug 12, 2026
…ssaging-icon-churn

perf(desktop): memoize PlatformAvatar + StatusDot (messaging icon churn)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have type/perf Performance improvement or optimization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants