Files
MeshTerm/meshterm/ui
Jean-Pierre MartineauandClaude Sonnet 5 2d2652005b Chat: cache each message independently, not a prefix
The transcript cache added in 9f600db cut off at the first "volatile"
message (pending ack or picked) and cached only the prefix before it.
Two bugs fell out of that:

- Deselecting a message never invalidated its cached (highlighted)
  rendering, so the old pick's ❯ stayed visible after moving to a new
  one — cache reuse only checked identity/acked, not whether the
  cached slice was rendered while picked.
- Picking a message near the start of a long transcript shrank the
  safe prefix to almost nothing, so every interaction re-rendered
  nearly the whole history again — performance regressed the further
  back you scrolled, recovering only once the pick returned to the
  tail.

Now each message's lines are memoized independently (keyed on
identity, acked, and whether it was rendered picked) and spliced in
or redrawn one at a time, regardless of position. Grouping context
(day/sender headers) is cheap enough to recompute unconditionally
every render rather than trust from the cache.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-02 02:14:32 -04:00
..