mirror of
https://github.com/langgenius/dify.git
synced 2026-05-02 00:18:03 +08:00
refactor(web): make Switch controlled-only and migrate call sites (#32399)
This commit is contained in:
@ -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>
|
||||
|
||||
@ -38,7 +38,7 @@ const ModerationContent: FC<ModerationContentProps> = ({
|
||||
}
|
||||
<Switch
|
||||
size="l"
|
||||
defaultValue={config.enabled}
|
||||
value={config.enabled}
|
||||
onChange={v => handleConfigChange('enabled', v)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@ -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,
|
||||
|
||||
Reference in New Issue
Block a user