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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user