fix(hub): keep the diff scroll and the typed answer across stream redraws

The stream rebuilt its list every few seconds, so a scrolled diff
jumped back to the top and the Other field lost focus and caret.
drawStream now runs inside keepTyping and keepScroll; keepScroll finds
the scrolled element again as the same nth element of its tag and
class in the same data-item row, so the stars Panels.decorate adds
after the draw do not shift it.

🎯 Fix: 95 %
💥 Break: 3 %
💸 Tokens: –
⏱️ Velocity: –
🛡️ Security: 100 %
🏆 Score: 92
🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 %

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kevin Veen-BirkenbachandClaude Opus 5.5 committed 2026-11-25 00:18:18 +00:00
1 parent dbc10536a4
commit 3d691b3706
3 files changed
+105 -2

No files matched your search

+2 -2
View File
@@ -164,10 +164,10 @@
stream.dom.list.replaceChildren(emptyState("Stream not readable", stream.error));
return;
}
stream.dom.list.replaceChildren(rows.length
keepTyping(stream.dom.list, () => keepScroll(stream.dom.list, () => stream.dom.list.replaceChildren(rows.length
? h("div", {class: "card flush"}, h("ol", {class: "feed"}, shown.map(eventRow)),
rows.length > shown.length ? h("p", {class: "footnote"}, `${rows.length - shown.length} older entries hidden; narrow down with a filter or the time range.`) : null)
: emptyState(stream.busy ? "Loading …" : "No entries", activeWaiting() ? "Nothing is waiting for you right now." : "Nothing in the chosen time range and filter."));
: emptyState(stream.busy ? "Loading …" : "No entries", activeWaiting() ? "Nothing is waiting for you right now." : "Nothing in the chosen time range and filter."))));
}
function streamScreen() {