Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
fix: fix possible undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
DanSnow committed Dec 8, 2023
1 parent f9ec127 commit 31a341a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/karbon/src/runtime/lib/article-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ export function evaluateCondition(article: Article, conditions: Condition[] = []
return article.desk[key] === cond.value || article.desk?.desk?.[key] === value
})
.with({ type: 'author' }, ({ value }) => {
return article.authors.some((author) => author.id === value)
return article.authors?.some((author) => author.id === value)
})
.with({ type: 'tag' }, ({ key, value }) => {
return article.tags.some((tag) => tag[key] === value)
return article.tags?.some((tag) => tag[key] === value)
})
.with({ type: 'featured' }, ({ value = true }) => {
return article.featured === value
Expand Down

0 comments on commit 31a341a

Please sign in to comment.