Skip to content

perf(app): keep still what nobody watches - #78

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

httpsphl merged 1 commit into
mainfrom
perf/app-calm

Conversation

@httpsphl

Copy link
Copy Markdown
Owner

Fifth slice of the performance round. It is independent of the others.

What changes

  • Mascots at rest stay still in the lists.
    • Before: every mascot in the sidebar and in the crew cards ran a d: path() morph on the flame outline, which is also the clipPath of the blurred shading. The browser repaints that every frame, one per bot, even for bots doing nothing.
    • Now ListAvatar keeps the mood's look (closed eyes, small ember) with data-still, and moves only when the bot works, waits for the owner or is at its usage limit.
    • The header and the reply being written are unchanged.
    • In the preview, idle and sleeping mascots now have 0 animations running.
  • Out of sight, nothing runs for nobody (shell/visibility.ts).
    • "Out of sight" means the page is hidden, or the app hid its own window in the tray (closing.ts), or it opened hidden at sign-in. The window coming to the front clears it.
    • While out of sight:
      • paused.css pauses every animation (in the preview, 99 paused while hidden, back to running when shown);
      • the system.status poll waits, and runs once when the window comes back.
  • The files.list scan (it walks the bot's folders) runs every 4 s only with the files panel open and in sight. With the panel closed, the new-files counter updates when the turn ends, when the list is already read once more.
  • Spec 15 describes the three changes. The new CSS is in its own file (paused.css); motion.css did not grow.

Not done here: animate-attention limited to cards that just arrived. It runs only once (1.4 s), so it isn't worth it.

Tests

  • visibility.test.tsx:
    • hiding and bringing back the window toggles data-hidden;
    • the status poll does not run while hidden and runs on return;
    • files.list polls only with the panel open and the window in sight.
  • avatar.test.tsx: ListAvatar is still when idle or asleep, and moves when working.
  • pnpm check passes.

Manual check (real app)

  • Close the window with the icon near the clock turned on. In Task Manager, the Botloft/WebView2 CPU drops to near zero with idle bots. Open it from the icon: the mascots of working bots move again.
  • Minimize and restore: the same.
  • With a bot working and the files panel closed, the counter shows the new files when the turn ends. With the panel open, the list updates during the turn.

Every mascot in the sidebar and the crew cards morphed its flame outline
forever, a clip path the browser repaints every frame, even for bots
doing nothing; and with the window hidden near the clock the animations,
the status poll and the file scans went on for nobody.

- ListAvatar: in the sidebar and the crew cards, a bot at rest (idle or
  sleeping) keeps its look but does not move; working, waiting and
  tired bots still do. The header and the reply being written are as
  before.
- shell/visibility.ts follows whether the window is in sight: the page's
  visibility, plus a mark the app sets when it hides its own window or
  opens hidden at sign-in, cleared when the window comes to the front.
  Out of sight, paused.css pauses every animation, and the status poll
  waits and reads once when the window is back.
- A working bot's files are scanned every 4 s only while the files
  panel is open and in sight; otherwise when the turn ends, as before.
@httpsphl
httpsphl merged commit 7dfd36d 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