fix: crashes when docs appear in the discover result (#494)
This commit is contained in:
parent
eb1dce0976
commit
0c470bed3e
|
|
@ -150,7 +150,7 @@ export function FeedIcon({
|
|||
|
||||
ImageElement = (
|
||||
<PlatformIcon
|
||||
url={feed?.siteUrl!}
|
||||
url={feed?.siteUrl || fallbackUrl}
|
||||
style={sizeStyle}
|
||||
className={cn("center mr-2", className)}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -16,17 +16,17 @@ const IconMap = Object.values(LinkParsers).reduce(
|
|||
|
||||
const shouldAddWhiteBgUrls = ["1x.com"]
|
||||
export const PlatformIcon: FC<{
|
||||
url: string
|
||||
url?: string
|
||||
children: React.JSX.Element
|
||||
className?: string
|
||||
style?: React.CSSProperties
|
||||
}> = ({ className, url, children, style, ...rest }) => {
|
||||
const iconName = getSupportedPlatformIconName(url)
|
||||
const iconName = url && getSupportedPlatformIconName(url)
|
||||
|
||||
if (!iconName || !IconMap[iconName]) {
|
||||
if (!iconName || !IconMap[iconName] || !url) {
|
||||
return (
|
||||
<Slot
|
||||
className={`${shouldAddWhiteBgUrls.some((_) => url.includes(_)) ? "bg-white" : ""} ${className}`}
|
||||
className={`${url && shouldAddWhiteBgUrls.some((_) => url.includes(_)) ? "bg-white" : ""} ${className}`}
|
||||
style={style}
|
||||
{...rest}
|
||||
>
|
||||
|
|
|
|||
Loading…
Reference in New Issue