-
Notifications
You must be signed in to change notification settings - Fork 359
fix(FormList): setFields failure in nested components
#3930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
commit: |
14e432a to
26d8253
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the form utility functions and improves TypeScript type safety while adding support for nested FormList field access. The changes primarily focus on renaming getMapValue to findFormItem, adding a new findFormItemDeep function for recursive searches, and enhancing type definitions throughout the form components.
Key changes include:
- Renaming
getMapValuetofindFormItemwith a more descriptive name and documentation - Adding
findFormItemDeepfunction to support finding FormItems in nested FormList structures - Improving TypeScript type annotations across FormItem interface methods and function parameters
- Updating error messages from Chinese to English for internationalization
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/components/form/utils/index.ts | Renamed getMapValue to findFormItem, added findFormItemDeep for nested FormList support, improved documentation |
| packages/components/form/hooks/useInstance.tsx | Updated function calls to use renamed utilities, enhanced error messages, improved type annotations, and refactored getValidateMessage for better structure |
| packages/components/form/FormList.tsx | Added formListMapRef property to FormItemInstance for nested field access |
| packages/components/form/FormItem.tsx | Enhanced TypeScript type definitions for FormItemInstance interface methods and improved parameter type annotations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
51ff027 to
72e99af
Compare
72e99af to
da3a716
Compare

🤔 这个 PR 的性质是?
🔗 相关 Issue
💡 需求背景和解决方案
复现代码存档
📝 更新日志
fix(Form): 修复嵌套
FormList无法使用setFields更新表单的问题chore(Form): 优化
getValidateMessage方法底层的逻辑本条 PR 不需要纳入 Changelog
☑️ 请求合并前的自查清单