Skip to content

Commit

Permalink
fix(media): if no src then return null
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Aug 28, 2024
1 parent a71eb3f commit 183009a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/renderer/src/components/ui/media.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ const MediaImpl: FC<MediaProps> = ({
)
}
default: {
throw new Error("Invalid type")
return null
}
}
}, [
Expand All @@ -191,13 +191,15 @@ const MediaImpl: FC<MediaProps> = ({
hidden,
imgSrc,
mediaContainerClassName,
mediaLoadState,
popper,
previewImageUrl,
props,
rest,
src,
type,
])
if (!type || !src) return null

if (hidden && showFallback) {
return <FallbackMedia {...props} />
Expand Down

0 comments on commit 183009a

Please sign in to comment.