fix: onTemplateSuccess undefined (#3119)

This commit is contained in:
katherinehhh 2023-11-30 17:32:42 +08:00 committed by GitHub
parent 06ba3bffcb
commit 1d01a66193
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -216,7 +216,7 @@ export const AddFieldAction = (props) => {
let children = [];
if (include?.length) {
include.forEach((k) => {
const field = v.children.find((h) => [k, k.interface].includes(h.value));
const field = v?.children?.find((h) => [k, k.interface].includes(h.value));
field &&
children.push({
...field,
@ -224,13 +224,13 @@ export const AddFieldAction = (props) => {
});
});
} else if (exclude?.length) {
children = v.children.filter((v) => {
children = v?.children?.filter((v) => {
return !exclude.includes(v.value);
});
} else {
children = v.children;
children = v?.children;
}
children.length &&
children?.length &&
optionArr.push({
...v,
children,
@ -270,7 +270,7 @@ export const AddFieldAction = (props) => {
label: compile(option.label),
title: compile(option.label),
key: option.label,
children: option.children
children: option?.children
.filter((child) => !['o2o', 'subTable', 'linkTo'].includes(child.name))
.map((child) => {
return {
@ -284,7 +284,7 @@ export const AddFieldAction = (props) => {
}),
};
})
.filter((v) => v.children?.length);
.filter((v) => v?.children?.length);
}, [getFieldOptions]);
const menu = useMemo<MenuProps>(() => {
return {

View File

@ -23,7 +23,7 @@ export const BlockTemplate = observer(
const onSuccess = (data) => {
fieldSchema['x-linkage-rules'] = data?.data?.['x-linkage-rules'] || [];
fieldSchema.setProperties(data?.data?.properties);
onTemplateSuccess();
onTemplateSuccess?.();
};
return template ? (
<BlockTemplateContext.Provider value={{ dn, field, fieldSchema, template }}>