-
-
Notifications
You must be signed in to change notification settings - Fork 275
fix: improve field value handling and touched state merging in FormStore #752
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: antd-5.x
Are you sure you want to change the base?
fix: improve field value handling and touched state merging in FormStore #752
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Walkthrough本次更改优化了 Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Form
participant FormStore
User->>Form: 调用 setFieldValue/setFieldsValue
Form->>FormStore: setFields
FormStore->>FormStore: 检查并更新字段 touched 状态
FormStore-->>Form: 通知字段变更(含合并后的 metadata)
Form-->>User: 字段状态更新(touched 状态一致)
Assessment against linked issues
Suggested reviewers
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## antd-5.x #752 +/- ##
=========================================
Coverage 99.44% 99.44%
=========================================
Files 18 18
Lines 1257 1269 +12
Branches 315 300 -15
=========================================
+ Hits 1250 1262 +12
Misses 7 7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
if ('touched' in data) { | ||
mergeTouched = data.touched; | ||
} else if (hasValue && previousFieldMeta !== null) { | ||
mergeTouched = !isEqual(this.getFieldValue(namePath), data.value) |
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.
不能在 setFields
里改 touched
来解决 setFieldValue
里没有设置 touched
的问题。setFields
本身是底层操作,它只改传入的 meta。
应该是 setFieldValue
里直接加上 touched: true
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.
应该是 setFieldValue 里直接加上 touched: true
value 没有 diff 也算吗?
fix: ant-design/ant-design#53981
Summary by CodeRabbit
Bug Fixes
Tests