From f39c540a1d0d808db692d8efe6b980527288701a Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Thu, 23 Feb 2023 17:46:11 +0800 Subject: [PATCH] fix: post editor --- src/formkit/inputs/category-select/components/CategoryTag.vue | 2 +- .../inputs/category-select/components/SearchResultListItem.vue | 2 +- src/modules/contents/posts/categories/utils/index.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/formkit/inputs/category-select/components/CategoryTag.vue b/src/formkit/inputs/category-select/components/CategoryTag.vue index 37a19b40..f8e02b53 100644 --- a/src/formkit/inputs/category-select/components/CategoryTag.vue +++ b/src/formkit/inputs/category-select/components/CategoryTag.vue @@ -24,7 +24,7 @@ const label = computed(() => { props.category.metadata.name ); return categories - .map((category: CategoryTree) => category.spec.displayName) + ?.map((category: CategoryTree) => category.spec.displayName) .join(" / "); }); diff --git a/src/formkit/inputs/category-select/components/SearchResultListItem.vue b/src/formkit/inputs/category-select/components/SearchResultListItem.vue index 5e7c80c7..5cc7bab5 100644 --- a/src/formkit/inputs/category-select/components/SearchResultListItem.vue +++ b/src/formkit/inputs/category-select/components/SearchResultListItem.vue @@ -33,7 +33,7 @@ const label = computed(() => { props.category.metadata.name ); return categories - .map((category: CategoryTree) => category.spec.displayName) + ?.map((category: CategoryTree) => category.spec.displayName) .join(" / "); }); diff --git a/src/modules/contents/posts/categories/utils/index.ts b/src/modules/contents/posts/categories/utils/index.ts index 13a9768c..0169e97e 100644 --- a/src/modules/contents/posts/categories/utils/index.ts +++ b/src/modules/contents/posts/categories/utils/index.ts @@ -126,7 +126,7 @@ export const getCategoryPath = ( categories: CategoryTree[], name: string, path: CategoryTree[] = [] -) => { +): CategoryTree[] | undefined => { for (const category of categories) { if (category.metadata && category.metadata.name === name) { return path.concat([category]);