refactor(web): make Switch controlled-only and migrate call sites (#32399)

This commit is contained in:
yyh
2026-02-18 23:47:07 +08:00
committed by GitHub
parent 368db04519
commit ea0e1b52a8
58 changed files with 182 additions and 223 deletions

View File

@ -48,7 +48,7 @@ const FeatureCard = ({
</Tooltip>
)}
</div>
<Switch disabled={disabled} className="shrink-0" onChange={state => onChange?.(state)} defaultValue={value} />
<Switch disabled={disabled} className="shrink-0" onChange={state => onChange?.(state)} value={value} />
</div>
{description && (
<div className="system-xs-regular line-clamp-2 min-h-8 text-text-tertiary">{description}</div>

View File

@ -38,7 +38,7 @@ const ModerationContent: FC<ModerationContentProps> = ({
}
<Switch
size="l"
defaultValue={config.enabled}
value={config.enabled}
onChange={v => handleConfigChange('enabled', v)}
/>
</div>

View File

@ -232,7 +232,7 @@ const VoiceParamConfig = ({
</div>
<Switch
className="shrink-0"
defaultValue={text2speech?.autoPlay === TtsAutoPlay.enabled}
value={text2speech?.autoPlay === TtsAutoPlay.enabled}
onChange={(value: boolean) => {
handleChange({
autoPlay: value ? TtsAutoPlay.enabled : TtsAutoPlay.disabled,