fix: fields options undefined (#3116)

This commit is contained in:
katherinehhh 2023-11-30 11:47:16 +08:00 committed by GitHub
parent 300d8f4eb3
commit cb22d0f2ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -242,7 +242,7 @@ export const AddFieldAction = (props) => {
const items = useMemo<MenuProps['items']>(() => {
return getFieldOptions()
.map((option) => {
if (option.children.length === 0) {
if (option?.children?.length === 0) {
return null;
}
if (record.template === 'view') {
@ -284,7 +284,7 @@ export const AddFieldAction = (props) => {
}),
};
})
.filter((v) => v.children.length);
.filter((v) => v.children?.length);
}, [getFieldOptions]);
const menu = useMemo<MenuProps>(() => {
return {