hermes-agent/apps/desktop/src
ethernet 0f05aaa2bf
perf(desktop): make session switching snappy on large transcripts (#65898)
Switching between chat sessions in the desktop app froze for up to ~1–2s on
large transcripts. Profiling the switch path surfaced three main-thread
blockers, fixed here minimally and without changing behavior.

1. JSON.stringify deep-compare (worst case). chatMessagesEquivalent compared
   message parts with JSON.stringify(a) === JSON.stringify(b) on every switch.
   On image-/large-blob-bearing transcripts this serialized every part twice
   and cost well over a second. Replaced with a structural compare that never
   stringifies: array-level identity fast-path, per-part reference fast-path,
   then type-aware field comparison. The compare's only consumer asks "did the
   transcript change, should I setMessages?", so it is deliberately
   conservative — a false-negative just causes one extra idempotent
   setMessages, while a false-positive (the unsafe direction) is avoided.

2. Scroll-settle loop. thread-list ran a requestAnimationFrame settle loop up
   to 90 frames (or 5 stable frames) on every sessionKey change, each frame
   forcing a synchronous layout read + write — racing the markdown paint for
   up to ~1.5s. A normal synchronous switch stabilizes within a couple
   frames, so the ceiling is now 2 stable frames / 15 max.

3. Synchronous first paint of up to 300 parts. On switch, thread-list reset
   the render budget to the full RENDER_BUDGET=300, so up to 300 parts went
   through markdown + shiki syntax-highlighting synchronously on the switch
   commit. It now paints a small FIRST_PAINT_BUDGET=60 first, then bumps to
   the full 300 in a requestAnimationFrame after the first commit.

Salvaged from PR #49807 by professorpalmer — re-applied to the restructured
file layout (use-session-actions/utils.ts, thread/list.tsx) and tests merged
into the existing utils.test.ts.

Co-authored-by: Cary Palmer <professorpalmer@users.noreply.github.com>
2026-07-16 18:19:41 -04:00
..
app perf(desktop): make session switching snappy on large transcripts (#65898) 2026-07-16 18:19:41 -04:00
components perf(desktop): make session switching snappy on large transcripts (#65898) 2026-07-16 18:19:41 -04:00
contrib fmt(js): npm run fix on merge (#65229) 2026-07-15 21:40:56 +00:00
fonts fix(desktop): crisp terminal text via opaque xterm canvas 2026-06-12 19:36:30 -05:00
hooks refactor(desktop): share theme-repaint observer; memory-graph depth polish 2026-06-30 02:06:29 -05:00
i18n feat(desktop): add background-task indicator to sidebar session rows (#65174) 2026-07-15 20:02:23 +00:00
lib fix(desktop): sidebar status indicators lag for background sessions 2026-07-16 17:08:08 -04:00
plugins feat(desktop): plugin manager, runtime loader, and plugins settings 2026-07-13 17:57:53 -04:00
sdk fmt(js): npm run fix on merge (#65229) 2026-07-15 21:40:56 +00:00
store fmt(js): npm run fix on merge (#65912) 2026-07-16 19:57:39 +00:00
themes refactor(desktop): retire desktop-controller for the contribution shell; views as contributions 2026-07-13 17:57:54 -04:00
types fix(moa): reject half-filled MoA saves at the API boundary and hold desktop autosave until slots are complete 2026-07-15 09:50:08 -07:00
global.d.ts feat(desktop): electron — openDir IPC + ⌘W menu bridge (tabs, not windows) 2026-07-13 17:57:54 -04:00
hermes-parity.test.ts feat(desktop): CLI/dashboard parity — skills hub, MCP test/toggle/catalog, maintenance ops, log filters (#57441) 2026-07-03 01:02:47 -07:00
hermes-profile-scope.test.ts fix(desktop): route gateway restart / status / update to the active profile 2026-06-24 19:16:26 -05:00
hermes.test.ts fix: limit desktop model pickers to explicit providers 2026-07-07 15:12:54 -07:00
hermes.ts Merge origin/main into bb/contrib-areas 2026-07-15 02:30:17 -04:00
main.tsx fix(desktop): slow session switch (#65890) 2026-07-16 15:34:53 -04:00
styles.css refactor(desktop): retire desktop-controller for the contribution shell; views as contributions 2026-07-13 17:57:54 -04:00
vite-env.d.ts Add Hermes desktop app (#20059) 2026-05-31 17:46:56 -05:00