Skip to content

Commit

Permalink
fix: Form ArrayField addWithInitValue should clone params, close #2351
Browse files Browse the repository at this point in the history
  • Loading branch information
pointhalo committed Jul 22, 2024
1 parent 818a1c8 commit dd8a903
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/semi-ui/form/arrayField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ class ArrayFieldComponent extends Component<ArrayFieldProps, ArrayFieldState> {
const updater = this.context;
const { field } = this.props;
const newArrayFieldVal = updater.getValue(field) ? updater.getValue(field).slice() : [];
newArrayFieldVal.push(rowVal);
const cloneRowVal = copy(rowVal);
newArrayFieldVal.push(cloneRowVal);
updater.updateStateValue(field, newArrayFieldVal, {});
updater.updateArrayField(field, { updateKey: new Date().valueOf() });
}
Expand Down

0 comments on commit dd8a903

Please sign in to comment.