From 4604e45573eccfff22551f72bc8072fdf8a68777 Mon Sep 17 00:00:00 2001 From: chenos Date: Mon, 27 Mar 2023 13:05:14 +0800 Subject: [PATCH] fix: cannot read properties of undefined (reading 'title') --- .../schema-initializer/components/CreateRecordAction.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/core/client/src/schema-initializer/components/CreateRecordAction.tsx b/packages/core/client/src/schema-initializer/components/CreateRecordAction.tsx index f28db872c..d23e034f4 100644 --- a/packages/core/client/src/schema-initializer/components/CreateRecordAction.tsx +++ b/packages/core/client/src/schema-initializer/components/CreateRecordAction.tsx @@ -88,14 +88,20 @@ export const CreateRecordAction = observer((props) => { const totalChildCollections = getChildrenCollections(collection.name); const inheritsCollections = enableChildren .map((k) => { + if (!k) { + return; + } const childCollection = totalChildCollections.find((j) => j.name === k.collection); + if (!childCollection) { + return; + } return { ...childCollection, title: k.title||childCollection.title, }; }) .filter((v) => { - return actionAclCheck(`${v.name}:create`); + return v && actionAclCheck(`${v.name}:create`); }); const [currentCollection, setCurrentCollection] = useState(collection.name); const ctx = useActionContext();