Fix TTS voice/lang defaults using names instead of slugs#11
Merged
Conversation
API model defaults return display names (e.g. "English", "Vivian") but select dropdowns use slugs as values. This caused lang/voice not matching any option on startup, and the voice fallback showing all voices from all languages with duplicate React keys. - Add resolveLangSlug/resolveVoiceSlug helpers that match by slug OR name - Apply resolution in both auto-defaults effect and handleSetDefaults - Match language by slug or name when filtering voices - Remove all-voices fallback (return empty until lang is set by effect) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
szwagros
approved these changes
Feb 24, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes TTS language/voice default selection mismatches by resolving API-provided display names to the slug values used by the form selects, preventing invalid initial selections and duplicate-key issues from the previous “all voices” fallback.
Changes:
- Added
resolveLangSlug/resolveVoiceSlughelpers to map defaults by slug or display name. - Applied slug resolution when auto-applying model defaults and when the user clicks “Set defaults”.
- Updated voice option filtering to match language by slug or name, and removed the “all voices” fallback (returns empty until a language is selected).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Address PR review: replace typeof selectedModel with DeApiModel | undefined for clarity, and use resolveLangSlug inside resolveVoiceSlug to handle cases where langSlug is a display name instead of a slug. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
API model defaults return display names (e.g. "English", "Vivian") but select dropdowns use slugs as values. This caused lang/voice not matching any option on startup, and the voice fallback showing all voices from all languages with duplicate React keys.
Description
Brief description of changes.
Type of Change
Testing
How was this tested?
Checklist