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