Watch
0
0
Fork
You've already forked hyperhive
0

swarm ui: a terminal keeps 2000 rows and folds a burst of rows in at once

useSwarmTermStream appended each event with [...rows, row] and never dropped one, so a tab on a busy agent grew without bound in memory and DOM and each event cost a copy of the whole list. appendRows (a pure module, tested) folds a batch in with one copy, coalesces as before, and keeps the newest 2000. Events are collected for 50ms and folded in together, so a burst is one render.

The comments that described the old coalescing in useSwarmTermStream.ts's header and in termMsg.ts's TermEnvelope doc named a hook that no longer exists (useLiveStream), so both now point at term-rows.ts, where the rule lives.
This commit is contained in:
iris 2026-11-19 19:07:02 +01:00 • committed by mara
commit 0a72f212da

View file

@ -192,6 +192,11 @@ scroll it, and it doesn't announce new rows, since many can arrive in a second.
Once you scroll up it stops following the newest row, and a **latest** badge over
its bottom-right corner scrolls back and follows again.
A terminal keeps its newest 2000 rows. When more arrive, the oldest drop off the
top: a terminal that follows the newest row doesn't show it, but one you scrolled far
up in loses what you were reading once 2000 rows have come in since. The terminal
adds rows that arrive within 50 ms of each other in one step, so a burst of rows is one redraw.
The page around it has a skip link (**skip to content**, the first Tab stop), a
`<main>` landmark that takes the focus when a page opens, and a hidden `<h1>`
with the page's name. The active tab in the header carries `aria-current`.