Skip to content

perf(app): a chat item no longer changes the bot it belongs to - #77

Merged
httpsphl merged 1 commit into
mainfrom
perf/app-store
Sep 30, 2026
Merged

httpsphl merged 1 commit into
mainfrom
perf/app-store

Conversation

@httpsphl

Copy link
Copy Markdown
Owner

Fourth slice of the performance round. It is independent of the others; with #76 the gain adds up: the open chat stops re-rendering on every tool call.

What changes

  • state.activity: the conversation-list line leaves the Bot object.
    • Before, each chat.item with activity created a new bot. That re-rendered the open bot's whole view (header, chat, every run), every conversation in the sidebar and every timeline row.
    • The map is filled by bots.list and bot.changed (which already carry lastActivity) and by chat.item. The sidebar and the alerts read it with activityOf.
  • The sidebar's Conversation is memoized: a change to one bot re-renders only its line.
  • MessageRow subscribed to the whole state.bots on every row. Now it reads only its two bots, and it is memoized.
  • attentionCount and actionableDead ran on every store change, sorting every delivery each time. Now they recompute only when their inputs change.

Tests

  • app.test.ts: a chat item changes the list line and keeps the same bot object.
  • pnpm check passes. In the FakeBotloft preview, the sidebar shows each bot's line and the timeline shows its senders and recipients.

Manual check (real Claude)

  • With a bot working, the sidebar line follows each tool and reply as before, and the approval notification still names the tool.

Every chat.item with a list line replaced the bot object, and everything
that shows the bot re-rendered: the open bot's whole view with its chat,
every conversation in the sidebar and every row of the crew timeline.

- The list line lives in its own map, state.activity, filled from
  bots.list and bot.changed (which carry it) and by chat.item; the
  sidebar and the alerts read it with activityOf.
- The sidebar's conversations are memoized, so a change to one bot
  re-renders only its line.
- A timeline row reads only its two bots instead of all of them, and
  is memoized.
- attentionCount and actionableDead, asked on every store change, are
  worked out again only when their inputs change.
@httpsphl
httpsphl merged commit 7ab5fba into main Sep 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant