Skip to content

Commit

Permalink
fix: handle empty category or tags for blog article
Browse files Browse the repository at this point in the history
  • Loading branch information
gmolki committed Jun 12, 2024
1 parent c3e45e6 commit d77b26c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/Blog/BlogArticleBreadcrumb/cmp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const BlogArticleBreadcrumb = (props: BlogArticleBreadcrumbProps) => {

if (!currentPage) return setLinks(BASE_LINKS);

const articleCategory = currentPage.data?.category.value.data;
const articleCategory = currentPage.data?.category?.value?.data;
const newLinks: ReactNode[] = [
...BASE_LINKS,
<Link
Expand Down
6 changes: 4 additions & 2 deletions src/components/Blog/BlogArticlesGrid/cmp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const AllBlogArticles = ({
if (tagsFilters) {
const { includeIds } = tagsFilters;
const blogTagsIds: string[] = fetchedBlogArticle.data?.tags?.map(
(tagRef: any) => tagRef.tag.value?.data.id
(tagRef: any) => tagRef.tag?.value?.data.id
);

if (includeIds.length !== 0) {
Expand Down Expand Up @@ -167,7 +167,9 @@ export const AllBlogArticles = ({
featureImage={blogArticle.featureImage}
blogArticleUrl={blogArticle.url}
size={articleSize}
category={blogArticle.category.value.data as BlogCategoryProps}
category={
blogArticle.category?.value?.data as BlogCategoryProps
}
/>
);
})}
Expand Down

0 comments on commit d77b26c

Please sign in to comment.