Repository navigation
Conversation
…effects (C2) Theme, sound, quotes and challenge controllers and the commandline theme list react via effects on config store keys instead of configEvent. Theme resolves one configured theme; picking a theme turns auto switch off via overrideConfig, so whole-config apply sets autoSwitchTheme last. Effects only run on changed values: theme pickers clear the random theme themselves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The reactive rewrite spans the whole theming blast radius and introduces a real regression where an internal randomizeTheme write now disables auto switch theme, so a human should confirm the intended override semantics.
1 open issue
What changed in this PR
Roadmap step C2: this PR replaces the imperative configEvent bus subscribers in the theme, sound, quotes and challenge controllers (and the commandline theme list) with SolidJS store effects (createEffectOn inside a createRoot) that react to individual getConfig keys. Because effects only run on an actual value change, re-picking the same setting no longer re-runs its reaction, so theme pickers now call the newly-exported clearRandom() themselves, and the "auto switch off on a manual theme pick" behaviour moves from ThemeController.set into config metadata overrideConfig.
Changes:
- Convert five config-bus subscribers to deferred store effects; export
ThemeController.clearRandomand call it from theme pickers. - Move auto-switch-off side effect into a shared
disableAutoSwitchThemeoverride ontheme/customTheme/customThemeColors, and applyautoSwitchThemelast in whole-config apply. - Add per-controller spec files plus override/apply-order config spec cases; drop the dead
showLiveWpmkey from the challenge list.
| File | Description |
|---|---|
| frontend/src/ts/controllers/theme-controller.ts | Replace config-bus subscriber with memo + deferred effects; export clearRandom; reorder randomizeTheme customTheme write |
| frontend/src/ts/controllers/sound-controller.ts | Effects on playSoundOnClick/soundVolume |
| frontend/src/ts/controllers/quotes-controller.ts | Effect on quoteLength |
| frontend/src/ts/controllers/challenge-controller.ts | Effect on 14 test keys; drop dead showLiveWpm |
| frontend/src/ts/config/metadata.tsx | disableAutoSwitchTheme override on theme keys (source of the reported bug) |
| frontend/src/ts/config/lifecycle.ts | Apply autoSwitchTheme last so theme overrides don't disable it on apply |
| frontend/src/ts/components/pages/settings/custom-setting/Theme.tsx | Call clearRandom() from preset/custom/custom-theme buttons |
| frontend/src/ts/commandline/lists/themes.ts | Effect on favThemes; clearRandom() in exec |
| frontend/src/ts/commandline/lists/custom-themes-list.ts | clearRandom() in exec |
| frontend/__tests__/... (6 files) | New controller/commandline specs + override/apply-order config cases |
| docs/specs/solid-monkeytype/roadmap.md | Document C2 behaviour changes |
Review effort: Balanced
…e writes randomizeTheme rewrites customTheme: false (nosave) after every result, which turned auto switch off for users with random theme on. Picking a preset while the custom theme was on also showed the notice twice: the theme override disabled auto switch and so did the customTheme: false it set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NZNRfGDYsGYMUTp2zYUTrv
# Conflicts: # docs/specs/solid-monkeytype/roadmap.md # frontend/src/ts/controllers/theme-controller.ts

Summary
Roadmap C2: config-bus subscribers outside the test become effects on config store keys.
Auto switch off on a manual pick moves from
ThemeController.setto config metadata:Behaviour changes:
clearRandomthemselves, so re-picking still drops a random theme.randomizeThemewritescustomTheme: falsebefore picking, so the theme effect doesn't clear the new random theme.showLiveWpmkey dropped from the challenge list.Evidence
Before: no tests for these reactions.
After: spec per controller (
__tests__/controllers/*,__tests__/commandline/lists/themes.spec.ts), plus override and apply-order cases in config specs. Full suite 1641 passing.Mutation checks (reverted fix → test fails):
Browser (dev): theme / custom / auto switch apply; picking a theme with auto switch on disables it with the notice; reload with auto switch on keeps it, no notice; random theme over custom works and re-picking the configured theme restores it; challenge survives load and volume change, clears on punctuation; commandline theme list puts new favorites first.
Merge Danger
Door: two-way
Pure frontend refactor, no persisted data shape change. Revert restores the bus subscribers.
Blast Radius: theming
Theme application on boot, sign-in, preset load, random theme and auto switch; challenge clearing; quote queue; click sounds.
🤖 Generated with Claude Code