fix: 修复 onBulkChange 可能不存在导致的报错 (#2575)

* fix: 修复 onBulkChange 可能不存在导致的报错

* 漏了一处
This commit is contained in:
吴多益 2021-09-17 12:49:44 +08:00 committed by GitHub
parent 825b36e65c
commit c6aea71b31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 6 deletions

View File

@ -793,7 +793,7 @@ export default class ImageControl extends React.Component<
}
: files[0]
);
onBulkChange(toSync);
onBulkChange && onBulkChange(toSync);
}
}

View File

@ -74,7 +74,7 @@ export default class StaticControl extends React.Component<StaticProps, any> {
);
}
onBulkChange(values, saveImmediately === true);
onBulkChange && onBulkChange(values, saveImmediately === true);
}
render() {

View File

@ -572,9 +572,10 @@ export function wrapControl<
if (!key || key === name) {
this.handleChange(value);
} else {
onBulkChange({
[key]: value
});
onBulkChange &&
onBulkChange({
[key]: value
});
}
}

View File

@ -232,7 +232,7 @@ export default class Service extends React.Component<ServiceProps> {
afterSchemaFetch(schema: any) {
const {onBulkChange, formStore} = this.props;
if (formStore && schema?.data && onBulkChange) {
onBulkChange(schema.data);
onBulkChange && onBulkChange(schema.data);
}
this.initInterval(schema);