Display never re-shows a slide's content if its id is unchanged, even when the HTML changed #21
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
paul_loth/krautspaceTV#21
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
display.html'sapplySlide()(around line 104-112) dedups purely on slide id:This is correct for avoiding flicker within a single slide's display window (the backend holds the same
id+htmlfor the wholerotation_interval_seconds, and the client polls every 5s — re-applying identical HTML every poll would be wasteful/flickery).But
backend/rotation.py's_rotation_step()re-renders every enabled slide from scratch on every lap of the rotation loop (shown_any/set_currentaround line 139-159) — so a slide with dynamic content (RSS feed, weather widget, departure board, anything server-rendered) gets genuinely newhtmlon its next lap, while keeping the exact sameid. The client-side dedup has no way to tell "same id, same content" apart from "same id, refreshed content" — it always takes the fast path and never updates the DOM.With the site's current 10-slide rotation this is masked, since many different ids cycle through between two occurrences of the same slide, resetting
lastIdin between. But it's a real bug that will bite:Suggested fix
Compare
data.html(or a cheap hash of it) in addition todata.id— only short-circuit when both are unchanged from last time. Something like:(
lastHtmlis already tracked, just not consulted in this check.)Where
backend/templates/display.html:104-112Fixed and deployed. applySlide() in display.html now short-circuits only when both id AND html are unchanged. Verified the fix doesn't regress first-load (lastId starts undefined) or the iframe-reset path (calls showHtml directly, bypassing applySlide entirely). kiosk.service restarted since this touches the template the kiosk browser loads once at startup.