Skip to content
This repository has been archived by the owner on Jan 30, 2025. It is now read-only.

Commit

Permalink
filter out falsy links from post preview
Browse files Browse the repository at this point in the history
  • Loading branch information
ceolinwill committed Mar 28, 2020
1 parent e8d9324 commit 609ee1e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/PostPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ const PostPreview = ({ data, onToggleExpand }: PostPreviewProps) => {

useEffect(() => {
if (links && links.length > 0) {
const promises = links.map((link) => getLinkMetadata(link));
const promises = links
.filter(Boolean)
.map((link) => getLinkMetadata(link));
Promise.all(promises).then(setSites);
}
}, [links]);
Expand Down

1 comment on commit 609ee1e

@vercel
Copy link

@vercel vercel bot commented on 609ee1e Mar 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.