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/set values behaving abnormally #1633

Open
wants to merge 2 commits into
base: release
Choose a base branch
from
Open
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 packages/semi-foundation/form/foundation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,12 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
setValues(values: any, { isOverride = false }): void {
const _values = this._adapter.cloneDeep(values);
this.fields.forEach(field => {
// If field is not in _values, it means that the field should not be updated, so return directly
// 如果field不在_values中,说明该field不应该被更新,所以直接return
if (ObjectUtil.has(_values, field.field)) {
return;
}

const value = ObjectUtil.get(_values, field.field);
// When calling setValues to override the values, only need to trigger onValueChange and onChange once, so setNotNotify of setValue to true
// 调用setValues进行值的覆盖时,只需要回调一次onValueChange、onChange即可,所以此处将setValue的notNotify置为true
Expand Down