Skip to content

Commit

Permalink
fix: handle null categories in release notes filtering to prevent errors
Browse files Browse the repository at this point in the history
  • Loading branch information
gfbollingerHakuna committed Aug 22, 2024
1 parent 71ee1c4 commit 866cafb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/templates/releaseNotesListing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ const ReleaseNotesListingTemplate = ({ data }) => {
// If there are selected categories, filter the data to include only items that belong to at least one of those categories
if(filters.categories.length > 0){
newFilteredData = newFilteredData.filter(item => {
const categories = item.node.frontmatter.categories || []

// Check if any category of the current item matches any of the selected categories
return item.node.frontmatter.categories.some(category => {
return categories.some(category => {
return filters.categories.some(filterCategory => filterCategory.slug === category)
})
})
Expand Down

0 comments on commit 866cafb

Please sign in to comment.