A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
refactor(ui): solve the problem that select onChange is invalid
robin4c114179c360
diff --git a/ui/src/components/SchemaForm/index.tsx b/ui/src/components/SchemaForm/index.tsxindex 7fe6d219..b56c3249 100644--- a/ui/src/components/SchemaForm/index.tsx+++ b/ui/src/components/SchemaForm/index.tsx@@ -102,7 +102,7 @@ const SchemaForm: FC<IProps> = ({const keys = Object.keys(properties);- const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {+ const handleChange = (e) => {const { name, value } = e.target;const data = {...formData,@@ -262,8 +262,10 @@ const SchemaForm: FC<IProps> = ({className={classnames('mb-3', formData[key].hidden && 'd-none')}><Form.Label>{title}</Form.Label><Form.Select+ name={key}aria-label={description}- isInvalid={formData[key].isInvalid}>+ isInvalid={formData[key].isInvalid}+ onChange={handleChange}>{properties[key].enum?.map((item, index) => {return (<option value={String(item)} key={String(item)}>@@ -355,7 +357,7 @@ const SchemaForm: FC<IProps> = ({<Form.Label>{title}</Form.Label><TimeZonePickervalue={formData[key]?.value}- onChange={handleInputChange}+ onChange={handleChange}/><Form.Controlname={key}@@ -413,7 +415,7 @@ const SchemaForm: FC<IProps> = ({placeholder={options?.placeholder || ''}type={options?.type || 'text'}value={formData[key]?.value}- onChange={handleInputChange}+ onChange={handleChange}isInvalid={formData[key].isInvalid}rows={options?.rows || 3}/>@@ -438,7 +440,7 @@ const SchemaForm: FC<IProps> = ({placeholder={options?.placeholder || ''}type={options?.type || 'text'}value={formData[key]?.value}- onChange={handleInputChange}+ onChange={handleChange}style={options?.type === 'color' ? { width: '6rem' } : {}}isInvalid={formData[key].isInvalid}/>diff --git a/ui/src/pages/Admin/Smtp/index.tsx b/ui/src/pages/Admin/Smtp/index.tsxindex a373ba81..a60ed5c1 100644--- a/ui/src/pages/Admin/Smtp/index.tsx+++ b/ui/src/pages/Admin/Smtp/index.tsx@@ -37,7 +37,7 @@ const Smtp: FC = () => {type: 'boolean',title: t('encryption.label'),description: t('encryption.text'),- enum: ['SSL', 'None'],+ enum: ['SSL', ''],enumNames: ['SSL', 'None'],},smtp_port: {