-
Notifications
You must be signed in to change notification settings - Fork 1
feat(FormStore): support nested structures in form data handling #498
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
base: master
Are you sure you want to change the base?
feat(FormStore): support nested structures in form data handling #498
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #498 +/- ##
==========================================
+ Coverage 74.98% 75.01% +0.02%
==========================================
Files 607 607
Lines 18764 18778 +14
Branches 2894 2897 +3
==========================================
+ Hits 14071 14087 +16
+ Misses 4150 4146 -4
- Partials 543 545 +2
🚀 New features to boost your workflow:
|
|
📐🤏 Size check result (c0b0701...0777175): error code: 1033 |
ba81f91 to
8b85d87
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 adds support for nested object and array structures in FormStore's form data handling, transitioning from flat field access to lodash path-based operations (get/set/has/unset). The implementation also introduces filtering for fields marked with notRender.
Key changes:
- Replace direct property access with lodash path-based methods to support nested field names like "user.name" and "items[0].name"
- Add
notRenderfield filtering across all data access methods - Update validation logic to handle nested data structures
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| shared/form/src/FormStore.ts | Core implementation changes to support nested structures using lodash path methods, add notRender filtering, and update validation type signatures |
| shared/form/src/FormStore.spec.ts | Add comprehensive tests for nested object/array structures and notRender field handling, update existing test expectations to match new behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
8b85d87 to
ae62374
Compare
ae62374 to
872ff75
Compare
Closes NEXT_BUILDER-5249
872ff75 to
127ae78
Compare
| const formData = Object.fromEntries( | ||
| Object.entries(this.#formData) | ||
| .map(([k, v]) => { | ||
| if (allFields.includes(k)) { |
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.
之前有个 allFields 的过滤,这个逻辑不需要了?
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
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return messageBody(message?.max || `${label}不能大于 ${max}`); | ||
| if (typeof value === "number" || typeof value === "string") { | ||
| const numberValue = | ||
| typeof value === "number" ? value : parseFloat(value); |
Copilot
AI
Dec 9, 2025
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.
When parseFloat(value) is called on a non-numeric string, it returns NaN. The subsequent comparisons numberValue < min and numberValue > max will always be false when numberValue is NaN, which means invalid numeric strings would silently pass validation.
Consider adding a check for NaN after parsing:
const numberValue = typeof value === "number" ? value : parseFloat(value);
if (isNaN(numberValue)) {
return messageBody(message?.pattern || `${label}必须是有效的数字`);
}| typeof value === "number" ? value : parseFloat(value); | |
| typeof value === "number" ? value : parseFloat(value); | |
| if (isNaN(numberValue)) { | |
| return messageBody(message?.pattern || `${label}必须是有效的数字`); | |
| } |
Closes NEXT_BUILDER-5249
依赖检查
组件之间的依赖声明,是微服务组件架构下的重要信息,请确保其正确性。
请勾选以下两组选项其中之一:
或者:
提交信息检查
Git 提交信息将决定包的版本发布及自动生成的 CHANGELOG,请检查工作内容与提交信息是否相符,并在以下每组选项中都依次确认。
破坏性变更:
feat作为提交类型。BREAKING CHANGE: 你的变更说明。新特性:
feat作为提交类型。问题修复:
fix作为提交类型。杂项工作:
即所有对下游使用者无任何影响、且没有必要显示在 CHANGELOG 中的改动,例如修改注释、测试用例、开发文档等:
chore,docs,test等作为提交类型。