fix: fixes wrong selection in model config dropdown (#80)

This commit is contained in:
Abhishek 2025-12-17 14:56:25 +07:00 committed by GitHub
parent 6ca163fc8c
commit 2e37c89310
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -110,9 +110,11 @@ export default function ServiceConfiguration() {
setServicePropertyValues("tts");
setServicePropertyValues("stt");
setServiceProviders(selectedProviders);
// IMPORTANT: Reset form values BEFORE changing providers
// Otherwise, Radix Select sees old values that don't match new provider's enum
// and calls onValueChange('') to clear "invalid" values
reset(defaultValues);
setServiceProviders(selectedProviders);
};
fetchConfigurations();
}, [reset, userConfig]);
@ -294,6 +296,9 @@ export default function ServiceConfiguration() {
<Select
value={watch(`${service}_${field}`) as string || ""}
onValueChange={(value) => {
// Ignore empty string - Radix Select sometimes calls onValueChange('')
// when options change, even if current value is valid
if (!value) return;
setValue(`${service}_${field}`, value, { shouldDirty: true });
}}
>