diff --git a/src/components/_common/headers/sharedHeaderUtils.ts b/src/components/_common/headers/sharedHeaderUtils.ts index 27e60c98a..d503e510b 100644 --- a/src/components/_common/headers/sharedHeaderUtils.ts +++ b/src/components/_common/headers/sharedHeaderUtils.ts @@ -24,7 +24,7 @@ export const getContentTagline = (content: GetContentTaglineProps, currentLangua return (selectedAudience && situationTaglines(selectedAudience)) ?? ''; } - if (taxonomy.length > 0 || customCategory) { + if ((taxonomy && taxonomy.length > 0) || customCategory) { const taxonomyStrings = getTranslatedTaxonomies(taxonomy, language); if (customCategory && taxonomyStrings.length === 0) { diff --git a/src/components/_common/overview-filters/taxonomy-filter/OverviewTaxonomyFilter.tsx b/src/components/_common/overview-filters/taxonomy-filter/OverviewTaxonomyFilter.tsx index 276132d91..31405b8c2 100644 --- a/src/components/_common/overview-filters/taxonomy-filter/OverviewTaxonomyFilter.tsx +++ b/src/components/_common/overview-filters/taxonomy-filter/OverviewTaxonomyFilter.tsx @@ -54,7 +54,7 @@ export const OverviewTaxonomyFilter = ({ items }: Props) => { }; const taxonomiesPresent = orderedTaxonomies.filter((taxonomy) => - items.some((item) => item.taxonomy.some((itemTaxonomy) => itemTaxonomy === taxonomy)) + items.some((item) => item.taxonomy?.some((itemTaxonomy) => itemTaxonomy === taxonomy)) ); const listHasGuidePage = items.some((product) => product.type === 'no.nav.navno:guide-page'); diff --git a/src/components/pages/office-page/office-details/officeInformation/OfficeInformation.tsx b/src/components/pages/office-page/office-details/officeInformation/OfficeInformation.tsx index 2397cee1a..dbf3ebc97 100644 --- a/src/components/pages/office-page/office-details/officeInformation/OfficeInformation.tsx +++ b/src/components/pages/office-page/office-details/officeInformation/OfficeInformation.tsx @@ -54,7 +54,7 @@ export const OfficeInformation = ({ officeData }: OfficeInformationProps) => { {getOfficeTranslations('location')} - {beliggenhet.adresseTilleggsnavn && ( + {beliggenhet?.adresseTilleggsnavn && ( {beliggenhet.adresseTilleggsnavn} )} {visitingAddress} diff --git a/src/store/hooks/useOverviewFilters.ts b/src/store/hooks/useOverviewFilters.ts index 1bbe5925d..5dfea71c6 100644 --- a/src/store/hooks/useOverviewFilters.ts +++ b/src/store/hooks/useOverviewFilters.ts @@ -16,7 +16,7 @@ import type Fuse from 'fuse.js'; export type OverviewFilterableItem = { area: Area[]; - taxonomy: ProductTaxonomy[]; + taxonomy?: ProductTaxonomy[]; type?: ContentType; }; @@ -43,7 +43,7 @@ const _getFilteredList = async ({ const isTaxonomyMatching = (item: ItemType) => taxonomyFilter === ProductTaxonomy.ALL || - item.taxonomy.includes(taxonomyFilter) || + item.taxonomy?.includes(taxonomyFilter) || (taxonomyFilter === ProductTaxonomy.OTHER && item.type === 'no.nav.navno:guide-page'); const itemsMatchingToggleFilters = filterableItems.filter(