Settings theme grid renders empty: t.colors undefined (regression from #113) #114

Closed
opened 2026-09-10 01:53:20 +00:00 by fen · 1 comment
Collaborator

Regression from #113 (PR #113, merged commit 7a2fa00f): the settings page theme grid renders ZERO cards on the dev server.

Root cause (reproduced in headless Chromium): the #113 fix replaced the hardcoded color lists with a presetColors(id) helper that reads getComputedStyle per preset, but the card-rendering line still references the OLD property:

btn.innerHTML = '<strong>' + t.name + '</strong>' +
  '<span class="swatches">' + t.colors.map(function (c) { ... })

themeNames entries now only have {id, name} - t.colors is undefined, so the first forEach iteration throws 'Cannot read properties of undefined (reading map)' (console line 73), the loop dies, and the grid stays empty. This is why the theme switcher looks missing in the UI.

Fix: use the colors variable returned by presetColors(t.id) instead of t.colors in the innerHTML build.

Also note: the QA verification missed this because it checked for the presence of the script/markup, not the rendered cards. QA for this fix must verify theme cards actually RENDER in a real browser (e.g. headless chromium --dump-dom and count class="theme-card" occurrences = 5).

Regression from #113 (PR #113, merged commit 7a2fa00f): the settings page theme grid renders ZERO cards on the dev server. Root cause (reproduced in headless Chromium): the #113 fix replaced the hardcoded color lists with a presetColors(id) helper that reads getComputedStyle per preset, but the card-rendering line still references the OLD property: btn.innerHTML = '<strong>' + t.name + '</strong>' + '<span class="swatches">' + t.colors.map(function (c) { ... }) themeNames entries now only have {id, name} - t.colors is undefined, so the first forEach iteration throws 'Cannot read properties of undefined (reading map)' (console line 73), the loop dies, and the grid stays empty. This is why the theme switcher looks missing in the UI. Fix: use the `colors` variable returned by presetColors(t.id) instead of t.colors in the innerHTML build. Also note: the QA verification missed this because it checked for the presence of the script/markup, not the rendered cards. QA for this fix must verify theme cards actually RENDER in a real browser (e.g. headless chromium --dump-dom and count class="theme-card" occurrences = 5).
fen added spent time 45 seconds 2026-09-10 01:53:57 +00:00
fen added the In Progress label 2026-09-10 01:54:09 +00:00
fen added QA and removed In Progress labels 2026-09-10 01:55:27 +00:00
fen added spent time 15 seconds 2026-09-10 02:00:53 +00:00
fen closed this issue 2026-09-10 02:01:38 +00:00
Author
Collaborator

QA passed (independent): diff verified (t.colors -> colors from presetColors(t.id)); go vet+go test clean on fix-114-theme-grid-empty; local headless chromium render of /settings = 5 theme-card elements; merged PR #115 into dev; CI (test+docker) success on dev HEAD 9ec7d515; deployed to palette-dev via rollout restart (pod 79c568dfb6-cqpf7 Running); live https://palette-dev.archfox.org/settings served script uses colors.map (no t.colors) and rendered DOM contains 5 theme-card elements.

QA passed (independent): diff verified (t.colors -> colors from presetColors(t.id)); go vet+go test clean on fix-114-theme-grid-empty; local headless chromium render of /settings = 5 theme-card elements; merged PR #115 into dev; CI (test+docker) success on dev HEAD 9ec7d515; deployed to palette-dev via rollout restart (pod 79c568dfb6-cqpf7 Running); live https://palette-dev.archfox.org/settings served script uses colors.map (no t.colors) and rendered DOM contains 5 theme-card elements.
fen added spent time 59 minutes 2026-09-10 13:57:36 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Total Time Spent: 1 hour
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: poslop/palette#114