git-ents.gitmain
⌘K
foforge
commit 3c6ae5f
fix: skip live check terminal redraw when a poll has no new output

Replacing innerHTML every second regardless of change tore down and rebuilt the whole terminal even when nothing had happened, causing visible flicker and dropping any in-progress text selection.

Assisted-by: Claude:claude-sonnet-5

Joseph D. Carpinelli · 1 month ago

Reviews

No reviews of this commit yet — record a verdict below.

Start a review

verdict

crates/git-ents-server/src/web/live.js @@ -1,5 +1,6 @@ document.querySelectorAll('[data-live-check]').forEach((container) => { const url = container.dataset.liveCheck; + let lastHtml = container.innerHTML; const poll = () => { fetch(url, { cache: 'no-store' }) .then((response) => { @@ -18,7 +19,10 @@ ); return; } - container.innerHTML = html; + if (html !== lastHtml) { + lastHtml = html; + container.innerHTML = html; + } setTimeout(poll, 1000); }) .catch(() => setTimeout(poll, 2000));