fix(templates): missing default value in select field (#11715)

### What?
The default value is hardcoded instead of respecting the value filled in
the form setting

Fixes #
pass it down from props

Co-authored-by: Pan <kpkong@hk01.com>
This commit is contained in:
AoiYamada
2025-04-15 00:38:40 +08:00
committed by GitHub
parent 85e6edf21e
commit 5b554e5256

View File

@@ -20,7 +20,7 @@ export const Select: React.FC<
control: Control
errors: Partial<FieldErrorsImpl>
}
> = ({ name, control, errors, label, options, required, width }) => {
> = ({ name, control, errors, label, options, required, width, defaultValue }) => {
return (
<Width width={width}>
<Label htmlFor={name}>
@@ -33,7 +33,7 @@ export const Select: React.FC<
</Label>
<Controller
control={control}
defaultValue=""
defaultValue={defaultValue}
name={name}
render={({ field: { onChange, value } }) => {
const controlledValue = options.find((t) => t.value === value)