Skip to content
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

fix :when rules change trigger validate #727

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ class Field extends React.Component<InternalFieldProps, FieldState> implements F
initEntityValue(this);
}
}

public componentDidUpdate({ rules: prevRules }) {
if (!isEqual(prevRules,this.props.rules)) {
this.validateRules();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个不对的,validateRules 和 validateTrigger 相关。ant-design/ant-design#51008 里遇到的是手工调用 validateFields 没有更新的问题。而不是 rules 更新后没有自动更新的问题。

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

奥奥我理解错了......我再看看

}
}

public componentDidMount() {
const { shouldUpdate, fieldContext } = this.props;
Expand Down