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:
parent
da187f8368
commit
0a72f212da
1 changed files with 129 additions and 29 deletions
|
|
@ -29,9 +29,9 @@ export interface TermMsg {
|
|||
|
||||
/** One SSE frame / history array entry — `hive-agent`'s `TermEnvelope`.
|
||||
* `seq` is the live per-event dedup counter (`BusEvent::seq`); absent on
|
||||
* history-replayed envelopes, see useLiveStream.ts's backfill dance. It is
|
||||
* the only field left: the event's time rides on each row's own `ts`, where
|
||||
* a consumer reading a bare row (the swarm queue's) can also see it.
|
||||
* history-replayed envelopes. It is the only field left: the event's time
|
||||
* rides on each row's own `ts`, where a consumer reading a bare row (the swarm
|
||||
* queue's) can also see it.
|
||||
*
|
||||
* Local to the per-hive stream — the swarm relay carries no envelope. */
|
||||
export interface TermEnvelope {
|
||||
|
|
|
|||
Loading…
Reference in a new issue