From dc98671544a64b4bc4d063901a0953de65f2b430 Mon Sep 17 00:00:00 2001 From: Agions <1051736049@qq.com> Date: Thu, 4 Jun 2026 16:21:56 +0800 Subject: [PATCH] fix(form): drop AntD Form/FormItem/useForm bridge, use native state instead MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit User direction: project doesn't need AntD compat, doesn't need AntD structural config. The
//useForm shim in shared/components/ui/ui-components.tsx was fake AntD (neither real AntD nor real RHF) and a source of confusion — Phase 2 dead-code cleanup exposed it via broken jest-skipped ProjectEdit/ProjectDetail tests that depended on this shim. Removed from ui-components.tsx: - component (97 lines, fake AntD onFinish bridge) - component + FormWithItem compound pattern - useForm re-export (was useRhfForm as useForm) - FormValues type - ValidationRule/FormProps/FormItemProps interfaces - useRhfForm import Replaced in 4 call sites with native React: 1. pages/project-edit/ProjectEditPage.tsx - useForm() bridge → useState for 2 fields (name, description) - setFieldsValue/validateFields/getFieldsValue/getFieldValue all gone - form.handleSubmit gone, validation is one if (!name.trim()) check - The page never rendered anyway — form lib was a value holder 2. features/script/components/ScriptGenerator.tsx - 8 useState hooks (topic/keywords/style/tone/length/audience/language/requirements) - buildFormValues() helper for handleGenerate payload - → native - 8 → direct - - - ({ value: opt.value, label: opt.label }))} - /> - - - - - 中文 - English - - - - -