From 7e32842a6dcebc8edc24a56c0e5563d021974005 Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Sun, 17 Mar 2024 22:16:11 +0800 Subject: [PATCH] fix: collections undefined inuseCollectionState (#3741) --- .../src/collection-manager/mixins/InheritanceCollectionMixin.ts | 2 +- .../schema-settings/DataTemplates/hooks/useCollectionState.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/client/src/collection-manager/mixins/InheritanceCollectionMixin.ts b/packages/core/client/src/collection-manager/mixins/InheritanceCollectionMixin.ts index fb199d692..3f9549c27 100644 --- a/packages/core/client/src/collection-manager/mixins/InheritanceCollectionMixin.ts +++ b/packages/core/client/src/collection-manager/mixins/InheritanceCollectionMixin.ts @@ -193,7 +193,7 @@ export class InheritanceCollectionMixin extends Collection { }; this.allCollectionsInheritChain = getInheritChain(this.name); - return this.allCollectionsInheritChain; + return this.allCollectionsInheritChain || []; } getInheritCollectionsChain() { diff --git a/packages/core/client/src/schema-settings/DataTemplates/hooks/useCollectionState.ts b/packages/core/client/src/schema-settings/DataTemplates/hooks/useCollectionState.ts index 894841639..5beb6deb8 100644 --- a/packages/core/client/src/schema-settings/DataTemplates/hooks/useCollectionState.ts +++ b/packages/core/client/src/schema-settings/DataTemplates/hooks/useCollectionState.ts @@ -26,7 +26,7 @@ export const useCollectionState = (currentCollectionName: string) => { const templateField: any = useField(); function getCollectionList() { - const collections = getAllCollectionsInheritChain(currentCollectionName); + const collections = getAllCollectionsInheritChain(currentCollectionName) || []; return collections.map((name) => ({ label: getCollection(name)?.title, value: name })); }