dashboard: a card-count change replaces the device rows, it does not stack them

The memory panel rebuilds its per-card rows when the card count changes, but the
rebuild only appended: the previous set stayed in #mem. Every card-count change --
a TP flip, a card swap, a lane re-pin -- therefore grew the panel by the old count,
permanently, until the page was reloaded. On a box that flips TP2 and TP4 by hand
the section becomes unusable within a day: eighteen rows of identical cards after
three flips, and the panel's own header (KV cache, prefix hits) scrolls away.

Remove the old rows before rebuilding, the same shape the request rows already use
above. Per-row removal rather than the sibling guards' container-clear because #mem
is shared with the KV and prefix meters, which are built once and must survive.

Verified: the embedded page parses (node --check on the extracted script), the
translation unit compiles, dashboard_test passes. The behavior itself -- rows gone
after a count change -- needs a live card-count change to prove; not tested here.

Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (xhigh) via Open WebUI
This commit is contained in:
Memoria (Noblistic) authored and StillDeadcode committed 2026-11-03 18:09:49 +01:00
1 parent 8bbf402d9e
commit bf7e473224
1 file changed
+8 -1
+8 -1
View File
@@ -2434,8 +2434,15 @@ function update(s, dt) {
/* ---- devices, in the same panel as the cache meter: they are one question. */
const cards = s.cards || [];
if (devs.length !== cards.length)
if (devs.length !== cards.length) {
/* Rebuild means REPLACE. The old rows must leave the panel: a card-count change -- a
* TP flip, a card swap -- otherwise stacks a fresh set on the stale one, and the panel
* grows by the old count every time until the page is reloaded. Per-row removal rather
* than the sibling guards' container-clear: #mem is shared with the KV and prefix
* meters, which are built once and must survive. Same shape as the request rows above. */
devs.forEach((d) => d.wrap.remove());
devs = cards.map((c) => meter($("mem"), "dev", c.name, c.index));
}
cards.forEach((c, i) => {
setBar(devs[i].i, c.vram_total ? c.vram_used / c.vram_total : 0, false);
devs[i].v.textContent = hbOf(c.vram_used, c.vram_total, " / ");