combo 减少没必要的更新

This commit is contained in:
liaoxuezhi 2019-11-29 23:48:55 +08:00
parent bb2bff5670
commit 78247ad8a7

View File

@ -367,12 +367,14 @@ export default class ComboControl extends React.Component<ComboProps> {
}
let value = this.getValueAsArray();
let isModified = false;
this.subFormDefaultValues = this.subFormDefaultValues.map(
({index, values, setted}) => {
const newValue = flat ? values.flat : {...values};
if (!setted && isObjectShallowModified(value[index], newValue)) {
value[index] = flat ? values.flat : {...values};
isModified = true;
}
return {
@ -383,6 +385,10 @@ export default class ComboControl extends React.Component<ComboProps> {
}
);
if (!isModified) {
return;
}
if (flat && joinValues) {
value = value.join(delimiter || ',');
}