Skip to content

fix(sitemap): clear iconcolor/labelcolor/valuecolor when an SSE event omits them - #1345

Merged
timbms merged 2 commits into
developfrom
fix/sitemap-color-not-clearing-sse
Sep 22, 2026
Merged

timbms merged 2 commits into
developfrom
fix/sitemap-color-not-clearing-sse

Conversation

@timbms

@timbms timbms commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • OpenHABWidget.apply(event:) merged SSE color updates with if let, so it could only set a color, never clear one. When a widget's color condition (e.g. iconcolor=[==ON="orange"]) stopped matching, the server's SSE event for that widget simply omits the color field instead of sending an empty string — so the stale color stuck around forever, until a full sitemap reload rebuilt the widget from scratch.
  • Regressed in Migrate sitemap page updates from long-polling to SSE #1168 (3.4.6 → 3.4.7), which moved sitemap updates from long-polling (always a full widget snapshot) to incremental SSE events. Reported via TestFlight feedback: a Switch item's iconcolor/labelcolor/valuecolor turned orange correctly on ON, but never reverted on OFF without a manual reload.
  • Colors are now recomputed as a group whenever an event carries a state change (event.state or event.enrichedItem present) — an omitted color defaults to "" instead of being left untouched. Non-state events (icon reload, visibility-only) still leave colors alone, since the server never touches them there.

Test plan

  • xcodebuild -workspace openHAB.xcworkspace -scheme openHAB build succeeds
  • Added colorClearsOnStateChangeAwayFromMatchingCondition and nonStateEventLeavesColorsUntouched to OpenHABWidgetEventApplicationTests, both pass
  • Full OpenHABCoreTests suite passes (-testPlan openHABTests -only-testing:OpenHABCoreTests)

🤖 Generated with Claude Code

timbms and others added 2 commits September 22, 2026 17:22
… omits them

OpenHABWidget.apply(event:) merged colors with `if let`, so it could only
set a color, never clear one. When a widget's color condition (e.g.
iconcolor=[==ON="orange"]) stopped matching, the server's SSE event for
that widget simply omits the color field instead of sending an empty
string — so the stale color stuck around until a full sitemap reload
rebuilt the widget from scratch.

Regressed in #1168 (3.4.6 -> 3.4.7), which moved sitemap updates from
long-polling (always a full widget snapshot) to incremental SSE events.

Colors are now recomputed as a group whenever an event carries a state
change (event.state or event.enrichedItem present) — an omitted color
defaults to "" instead of being left untouched. Non-state events (icon
reload, visibility-only) still leave colors alone, since the server never
touches them there.

Signed-off-by: Tim Mueller-Seydlitz <timbms@gmail.com>
@timbms
timbms merged commit 5589fc3 into develop Sep 22, 2026
2 checks passed
@timbms
timbms deleted the fix/sitemap-color-not-clearing-sse branch September 22, 2026 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant