From 175e4e653cdb65b6b472ae8364f3919c5bc79071 Mon Sep 17 00:00:00 2001 From: mwiegand Date: Tue, 12 May 2026 23:26:54 +0200 Subject: [PATCH] fix(live-state): eliminate flash on poll by switching to innerHTML swap outerHTML removes and re-inserts the section on each tick, causing a blank frame. Keeping the
as a stable DOM container and swapping only innerHTML means avatars and text update in-place without any teardown/reconstruct cycle. Co-Authored-By: Claude Opus 4.7 (1M context) --- l4d2web/templates/_live_state.html | 121 +++++++++++++-------------- l4d2web/templates/server_detail.html | 2 +- 2 files changed, 59 insertions(+), 64 deletions(-) diff --git a/l4d2web/templates/_live_state.html b/l4d2web/templates/_live_state.html index 32476d6..00944d1 100644 --- a/l4d2web/templates/_live_state.html +++ b/l4d2web/templates/_live_state.html @@ -1,65 +1,60 @@ -
-

Live state

- {% if not snapshot or not snapshot_fresh %} -

No data — server is not currently reporting.

- {% else %} -

- {{ snapshot.players }}/{{ snapshot.max_players }} - {% if snapshot.hibernating %}· idle{% endif %} - · {{ snapshot.map }} - - polled {{ ((now - snapshot.last_seen_at).total_seconds() | int) }}s ago - -

- {% endif %} +

Live state

+{% if not snapshot or not snapshot_fresh %} +

No data — server is not currently reporting.

+{% else %} +

+ {{ snapshot.players }}/{{ snapshot.max_players }} + {% if snapshot.hibernating %}· idle{% endif %} + · {{ snapshot.map }} + + polled {{ ((now - snapshot.last_seen_at).total_seconds() | int) }}s ago + +

+{% endif %} - {% if current_players %} -

Current players

- - {% endif %} +{% if current_players %} +

Current players

+ +{% endif %} - {% if recent_players %} -

Recent players

- - {% endif %} -
+{% if recent_players %} +

Recent players

+ +{% endif %} diff --git a/l4d2web/templates/server_detail.html b/l4d2web/templates/server_detail.html index 508f044..3478e44 100644 --- a/l4d2web/templates/server_detail.html +++ b/l4d2web/templates/server_detail.html @@ -22,7 +22,7 @@
+ hx-swap="innerHTML">

Files