fix(voices): apply settings-page voice changes to host menus immediately (#475)#477
Merged
Conversation
…ely (#475) Picking a voice in the settings catalog switched TTS at once (the preference cache updates on the storage write) but the host page's selector kept showing the old voice until its next repopulate. PreferenceModule already relays the storage change into the tab as a userPreferenceChanged event carrying voicePreferences — the selectors just never listened. VoiceSelector now subscribes and applies the re-read stored voice in place: Claude updates its trigger label + checkmarks (and pins a shortlist-hidden voice for the next populate); the Pi button grids re-mark the selected row. No repopulate, so an open menu is never torn down. Closes #475 Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_012DZR4Vp9B1RiKVrkfYiM1o
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Founder tasting feedback on Patch A (#470): pick Lucy in the settings Voices catalog while claude.ai is open — the next utterance is Lucy's voice, but the host page's voice button keeps saying "Cassidy" until some later repopulate.
What
The plumbing already existed: the settings page persists
voicePreferencestochrome.storage.local, andPreferenceModule'sstorage.onChangedlistener relays it into the host tab as auserPreferenceChangedEventBus event (src/prefs/PreferenceModule.ts:445). Nothing on the menu side listened.VoiceSelectornow subscribes (registerVoicePreferenceChangeHandler): on a voice-preference event addressed to this chatbot, it re-reads the stored voice through the preference module (cache already updated) and calls a newapplySelectedVoicehook.ClaudeVoiceMenuoverride: updates the trigger label, active-state icon, and row checkmarks via the existingupdateSelectedVoice, pinning shortlist-hidden voices so the row appears on next open.No repopulate happens on this path, so the open-menu teardown guard from #470 is preserved — an open menu is never rebuilt under the user.
Tests (fail-first)
New
test/chatbots/VoiceMenu-preference-sync.spec.ts(4 tests): Claude label+checkmark update on the event, cross-chatbot events ignored, cleared preference handled, Pi grid re-marking. All failed before the fix (no handler existed); fullnpm testgate green after, re-run post-rebase onto the #476 merge.Closes #475
🤖 Generated with Claude Code
https://claude.ai/code/session_012DZR4Vp9B1RiKVrkfYiM1o