@@ -13,7 +13,7 @@ function FeedCardImage({ src, variant }: { src: string; variant: FeedCardVariant
1313 const canvasRef = useRef < HTMLCanvasElement > ( null ) ;
1414 const { src : cleanSrc , blurhash, width, height } = parseImageUrlMetadata ( src ) ;
1515 const { failed, imageRef, loaded, onError, onLoad } = useImageLoadState ( cleanSrc ) ;
16- const aspectRatio = width && height ? `${ width } / ${ height } ` : undefined ;
16+ const aspectRatio = width && height ? `${ width } / ${ height } ` : "16 / 9" ;
1717 const imageFrameClass =
1818 variant === "editorial"
1919 ? "relative flex max-h-80 w-full flex-row items-center overflow-hidden rounded-[20px]"
@@ -91,7 +91,7 @@ export type FeedCardProps = {
9191 top ?: number ;
9292 title : string ;
9393 summary : string ;
94- hashtags : { id : number , name : string } [ ] ;
94+ hashtags ? : { id : number , name : string } [ ] ;
9595 createdAt : Date ;
9696 updatedAt : Date ;
9797 preview ?: boolean ;
@@ -101,6 +101,7 @@ export type FeedCardProps = {
101101export function FeedCard ( { id, title, avatar, draft, listed, top, summary, hashtags, createdAt, updatedAt, preview = false , variant } : FeedCardProps ) {
102102 const { t } = useTranslation ( ) ;
103103 const siteConfig = useSiteConfig ( ) ;
104+ const safeHashtags = Array . isArray ( hashtags ) ? hashtags : [ ] ;
104105 const activeVariant = normalizeFeedCardVariant ( variant ?? siteConfig . feedCardVariant ) ;
105106 const styles = FEED_CARD_STYLES [ activeVariant ] ;
106107 const body = (
@@ -128,9 +129,9 @@ export function FeedCard({ id, title, avatar, draft, listed, top, summary, hasht
128129 { top === 1 && < span className = "text-theme" > { t ( 'article.top.title' ) } </ span > }
129130 </ p >
130131 < p className = { `${ styles . summary } ${ activeVariant === "editorial" ? "mt-4 max-w-3xl" : "" } ` } > { summary } </ p >
131- { hashtags . length > 0 &&
132+ { safeHashtags . length > 0 &&
132133 < div className = { `flex flex-row flex-wrap justify-start gap-2 ${ activeVariant === "editorial" ? "mt-4" : "mt-2 gap-x-2" } ` } >
133- { hashtags . map ( ( { name } , index ) => (
134+ { safeHashtags . map ( ( { name } , index ) => (
134135 < HashTag key = { index } name = { name } />
135136 ) ) }
136137 </ div >
0 commit comments