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]);