Skip to content

Commit

Permalink
fix: logical error
Browse files Browse the repository at this point in the history
  • Loading branch information
mbifulco committed Dec 12, 2024
1 parent 8d93714 commit 869c488
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/lib/external-references.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,8 @@ export const getAllExternalReferences = async () => {
export const getAllExternalReferencesByTag = async (tag: string) => {
const refs = await getAllExternalReferences();

return refs.filter((article) => [...article.frontmatter.tags].includes(tag));
return refs.filter((article) => {
const tags = article.frontmatter?.tags ?? [];
return tags.includes(tag);
});
};
5 changes: 4 additions & 1 deletion src/lib/newsletters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@ export const getAllNewsletters = async () => {
export const getAllNewslettersByTag = async (tag: string) => {
const refs = await getAllNewsletters();

return refs.filter((article) => [...article.frontmatter.tags].includes(tag));
return refs.filter((article) => {
const tags = article.frontmatter?.tags ?? [];
return tags.includes(tag);
});
};

0 comments on commit 869c488

Please sign in to comment.