Skip to content

fix(themes): desktop repaints when the ACTIVE skin is edited in place - #69581

Merged
OutThisLife merged 1 commit into
mainfrom
bb/skin-live-edit-repaint
Jul 22, 2026
Merged

fix(themes): desktop repaints when the ACTIVE skin is edited in place#69581
OutThisLife merged 1 commit into
mainfrom
bb/skin-live-edit-repaint

Conversation

@OutThisLife

Copy link
Copy Markdown
Collaborator

Third and final leg of the live-theme loop (#68857, #69533). Repro from dogfooding session 20260722_145956_5ebda8: Hermes activates a new skin — every surface paints (that's #69533 working). Then "make it hot pink" — Hermes rewrites the same skin file. TUI repaints; desktop doesn't.

Why

Everything upstream was already correct:

The repaint on a recolor is supposed to come from the registry: the active theme IS that skin, and its palette just changed. ThemeProvider even subscribes to $backendThemes… but memoized the derived active theme on [themeName, resolvedMode] only, while deriveTheme reads the registry non-reactively (resolveTheme$backendThemes.get()). The store update re-rendered the provider and the memo handed back the stale palette — so applyTheme never re-ran. A name switch busts the memo (that's why activation worked); an in-place edit never did.

Fix

One memo: add the theme stores (userThemes, backendThemes, registryVersion) to the activeTheme deps — they're deriveTheme's actual reactivity, exactly mirroring the availableThemes memo ten lines above. No new events, no guard changes. applyTheme is idempotent and $backendThemes only publishes on a real palette diff, so there are no spurious repaints.

Also covers the sibling paths for free: an in-place edit of an active user-installed theme and a registry-contributed theme update now repaint too.

Tests

context.test.tsx renders the real ThemeProvider (jsdom, CSS vars on :root):

  • activation applies the backend skin ✓
  • same-name recolor repaints — fails on main without the fix ✓
  • an inactive-skin seed doesn't touch the painted theme ✓

Themes suite 66✓ (8 files), typecheck + lint clean.

Live theme authoring's core loop — Hermes recolors the skin file it just
activated — repainted the TUI but not the GUI. The event path was fine
(post-#69533 the WS broadcast lands and ingestBackendSkin refreshes the
$backendThemes registry); the same-name apply guard also no-ops correctly
(it's what protects a manual desktop theme pick). The repaint was supposed
to come from the registry: the active theme IS that skin, its palette just
changed. But ThemeProvider memoized deriveTheme on [themeName, resolvedMode]
only, while deriveTheme reads the registry non-reactively via resolveTheme —
so the store update re-rendered the provider and handed back the stale
palette. Name switches repainted (themeName moves); recolors never did.

Add the theme stores (user/backend/registry) to the memo's deps — they are
deriveTheme's actual reactivity, same as the availableThemes memo directly
above. applyTheme is idempotent, and $backendThemes only publishes on a
real palette change, so no spurious repaints.

Tests: render ThemeProvider for real — activation applies; a same-name
recolor repaints (fails without the fix); an inactive-skin seed doesn't
touch the painted theme.
@OutThisLife
OutThisLife enabled auto-merge July 22, 2026 20:09
@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

running on afd0270

CI timings

CI timings · View job

Wall time 8m33s vs 8m15s (+3.6%). 3 job(s) slower, 3 faster, 1 unchanged.

  • Build&Test Docker image / build (arm64, ubuntu-24.04-arm, linux/arm64, type=gha,scope=docker-arm64, type=gha,mode=max,scope...: -56.0s
  • Build&Test Docker image / build (amd64, ubuntu-latest, linux/amd64, type=gha,scope=docker-amd64, type=gha,mode=max,scope=do...: +10.0s
  • OSV scan / Scan lockfiles / osv-scan: -6.0s
  • Detect affected areas: +4.0s
  • OSV scan / Emit review status: -2.0s

@OutThisLife
OutThisLife merged commit 87088d1 into main Jul 22, 2026
27 checks passed
@OutThisLife
OutThisLife deleted the bb/skin-live-edit-repaint branch July 22, 2026 20:14
randlee pushed a commit to randlee/hermes-agent that referenced this pull request Aug 11, 2026
…edit-repaint

fix(themes): desktop repaints when the ACTIVE skin is edited in place
33hodl pushed a commit to 33hodl/hermes-agent that referenced this pull request Aug 12, 2026
…edit-repaint

fix(themes): desktop repaints when the ACTIVE skin is edited in place
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