This is an automated email from the ASF dual-hosted git repository.

shuai pushed a commit to branch test
in repository https://gitbox.apache.org/repos/asf/answer.git


The following commit(s) were added to refs/heads/test by this push:
     new cc1567ac fix: Fix incorrect default value when the input type is 
number in SchemeForm.
cc1567ac is described below

commit cc1567ac4ba4a13b972e9c0b7f28e8320c3bd7ca
Author: shuai <[email protected]>
AuthorDate: Mon Jan 26 14:25:25 2026 +0800

    fix: Fix incorrect default value when the input type is number in 
SchemeForm.
---
 ui/src/components/SchemaForm/components/Input.tsx | 6 +++++-
 ui/src/pages/Admin/QaSettings/index.tsx           | 2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ui/src/components/SchemaForm/components/Input.tsx 
b/ui/src/components/SchemaForm/components/Input.tsx
index a1838151..2f062b61 100644
--- a/ui/src/components/SchemaForm/components/Input.tsx
+++ b/ui/src/components/SchemaForm/components/Input.tsx
@@ -73,12 +73,16 @@ const Index: FC<Props> = ({
     }
   };
 
+  // For number type, use ?? to preserve 0 value; for other types, use || for 
backward compatibility
+  const inputValue =
+    type === 'number' ? (fieldObject?.value ?? '') : fieldObject?.value || '';
+
   return (
     <Form.Control
       name={fieldName}
       placeholder={placeholder}
       type={type}
-      value={fieldObject?.value || ''}
+      value={inputValue}
       {...numberInputProps}
       inputMode={inputMode}
       onChange={handleChange}
diff --git a/ui/src/pages/Admin/QaSettings/index.tsx 
b/ui/src/pages/Admin/QaSettings/index.tsx
index 17834ab0..67685ba8 100644
--- a/ui/src/pages/Admin/QaSettings/index.tsx
+++ b/ui/src/pages/Admin/QaSettings/index.tsx
@@ -49,6 +49,7 @@ const QaSettings = () => {
         type: 'number',
         title: t('min_tags.label'),
         description: t('min_tags.text'),
+        default: 0,
       },
       min_content: {
         type: 'number',
@@ -124,6 +125,7 @@ const QaSettings = () => {
         formMeta.min_tags.value = res.min_tags;
         formMeta.min_content.value = res.min_content;
         formMeta.restrict_answer.value = res.restrict_answer;
+        console.log('res', res, formMeta);
         setFormData(formMeta);
       }
     });

Reply via email to